Ranter
Join devRant
Do all the things like
++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatar
Sign Up
Pipeless API
From the creators of devRant, Pipeless lets you power real-time personalized recommendations and activity feeds using a simple API
Learn More
Comments
-
I don't have the answer but my go to test website is regex101.com, put your expression there it will tell you what's wrong
-
I'm not sure what you want to achieve...
new Regex('^\\\\....
If u need a \.
As the \ needs to be escaped two times! -
@sunfishcc maybe try ACK the Perl regular expressions? It should offer you more control.
https://beyondgrep.com/why-ack/ -
-
@IntrusionCM match 0 to n char with \w, which doesn't work with new RegExp('...'). I get around with [a-z]. But this garbage blows my mind
-
Meh. Tired braint fart.
Deleted my last comment as I totally misread the first line. -
@IntrusionCM no problem. At least you try to help 👍 the inconsistency in JS made my pull my hair off
-
Digging in a mine field....
The only thing I remember was that new RegExp had a different behaviour in escaping and that the second argument is important - but I really have no clue if it applies in your situation.
And yes. Escaping in regex is most of the time madness - playing Hyde (brute forcing try and Error) and Jekyll (orgasmic happiness cause it makes all sense suddenly) -
sak9625726y@sunfishcc
Try https://w3schools.com/jsref/...
From syntax part I see you are having trouble with escaping quote with "\\w"
Or simply /\w\
I need to build a dynamic regular expression with matching 0 or more char, but \w doesn’t work.
new RegExp(‘^\/\w*#’ + route, ‘i’)
Any solution? 🥺
question
javascript
regular expression
regexp