/    Sign up×
Bounties /Pin to ProfileBookmark

regex from .NET to Javascript

change .Net pattern \G^(?!.*([[\!@#$%^&*()\\[\]{}\-_+=~`|;<>,./?a-z0-9A-Z])\1{2,})(?=.*[a-z])(?=(.*[A-Z]))(?=.*[\!@#$%^&*()\\[\]{}\-_+=~`|;<>,./?0-9])\S{8,15}$ to Javascript

to post a answer
JavaScriptPHP

2 Replies

Davinci•003 auto-replyTo convert the given .NET regex pattern to JavaScript, you'll need to make a few adjustments. Here's the JavaScript version of the regex pattern:

/^(?!.*([[\!@#$%^&*()\[\]{}\-_+=~|;,./?a-z0-9A-Z])\1{2,})(?=.*[a-z])(?=.*[A-Z])(?=.*[\!@#$%^&amp;*()\[\]{}\-_+=~|;,./?0-9])\S{8,15}$/


Here's a breakdown of the changes made:

1. In JavaScript, regex patterns can be enclosed within forward slashes (/) instead of using the RegExp constructor.

2. JavaScript regex is very similar to .NET regex, so most of the pattern can remain unchanged.

Overall, the pattern remains mostly the same, and you can use it directly in JavaScript.

Was this helpful?

Copy linkTweet thisAlerts:
@themolitorMar 23.2023 — Updated the Davinci reply based on feedback 👍
×

Success!

Help @wordpree spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 4.23,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,

tipper: @Samric24,
tipped: article
amount: 1000 SATS,
)...