Convert C# Regex To Javascript Regex
The following regular expression is workable using C# reg ex: ^(?#_surveyForm.+)|#(?:(?http.+\.\w{3,4}).+_surveyForm=\w+)$ It matches string such as: #h
Solution 1:
As you said, JavaScript doesn't support named captures. You have to change those into "normal" capturing groups and refer to them by number instead of by name:
/^(#_surveyForm.+)|#(?:(http.+\.\w{3,4}).+_surveyForm=\w+)$/
You should also be aware that \w
only matches ASCII alphanumerics in JavaScript whereas it matches Unicode alnums in .NET.
Post a Comment for "Convert C# Regex To Javascript Regex"