Skip to content

Tag: regex

How to match multiple words in multiple lines

I have a multiline text, e.g. I need to see if two words present in whole text (AND operator). I tried something like: Answer You can try this regex: [sS] matches literally everything, encluding line wraps b is the word bound, so word1 count but sword1 does not. And since you treat all the lines as a whole, y…

Validate Range of Numbers

I am trying to validate a comma separated list of numbers 1-384 unique (not repeating). i.e. 1, 2, 3, 5, 6, 7, 9 is valid 1-3, 5-7, 9 is valid 2, 2, 6 is invalid 2, is invalid 1, 2, 3, 4, 15, 6, 7, 385 is invalid because the last number is more than 384 I have tried the

Match specific string which not contains specific pattern

I have urls and want to match only those which match this pattern but not contains this type=inbox – so for example – regexp should give following results: I try this but get wrong results (good only when type=inbox is at the end of string) How to do it using JavaScript RegExp? Answer The pattern …

Need help to match regex with conditional concatenation (JS)

I need help to accomplish the use cases of this regex: https://regex101.com/r/HmDQHJ/3/ Right now, my issue is that I need to match this: But also fail on this: Can someone help me to accomplish this? Thank you! More context: We have an old crawler that goes project source and looks for usage of a function ca…