This question already has answers here:
Why does the order of alternatives matter in regex?
(1 answer)
Order of regular expression operator (..|.. ... ..|..)
(1 answer)
Closed 2 years ago.
Hi I am using a regex checker regex101.com to verify that my regex pattern is working. What I dont understand is why the position of my pattern
\/checkout\/index.jsp\?announceEmpty.*
does not work when it is at the end of my pattern match.
This regex DOES NOT work
\/checkout\/index.jsp.skipReprice=true|\/checkout\/index.jsp|\/checkout\/index.jsp\?announceEmpty.*
vs. this DOES work
\/checkout\/index.jsp.skipReprice=true|\/checkout\/index.jsp\?announceEmpty.*|\/checkout\/index.jsp
and these are the texts to match against
/checkout/index.jsp?skipReprice=true
/checkout/index.jsp
/checkout/index.jsp?announceEmpty=1&lastItemRemoved=Gola%20x%20
Related
This question already has answers here:
Regular expression to match a line that doesn't contain a word
(34 answers)
Closed 2 years ago.
I need a regex that will accept all paths except those that have /cantbe or /cantbe/this
So
this/is/ok/filename.tr
is a match but
this/is/ok/cantbe/filename.tr
or
this/is/ok/cantbe/this/filename.tr
are not matches.
I tried
.*(?!\/cant\/)(?!\/cant\/this).*\.tr
but the paths above are still matches
try this
^((?!\/cantbe\b).)*$
Try it out here
This is explained quite well on this question
Regular expression to match a line that doesn't contain a word
This question already has answers here:
How to find overlapping matches with a regexp?
(4 answers)
Closed 3 years ago.
I'm trying to extract the repeated pattern from a string.
For example with something like "112112112112" I would want to end up with "112".
I've been having problems where I either end up with "1" or "112112".
The patterns can be of any size.
Here's an example of the kind of expressions I've been playing around with.
^(.+)(?=\1)
There are repeated patterns with different sizes, if 3 would be desired, for instance, we'd use a quantifier for that, such as:
(.{3})(?=\1)
Demo 1
or
(.{3,5})(?=\1)
Demo 2
This question already has an answer here:
Reference - What does this regex mean?
(1 answer)
Closed 3 years ago.
I have the following string and I want to find a proper regex for it, so I can use it in Regular Expression in Jmeter:
DocumentId_123456
The point is that every time the numbers have different length.
so basically I want everything between _ and the end of string.
Please try it, I guess it works in jmeter
DocumentId_(\d+)
Uou can check it here: [https://regex101.com/]
This question already has an answer here:
Learning Regular Expressions [closed]
(1 answer)
Closed 5 years ago.
Can someone help for regular expression for the following (only alphanumeric upper and lower case with - after 12 characters) i need to use in in my groovy assertion.
7AYNEHFjEee4-AJiXJP2jg
assert '7AYNEHFjEee4-AJiXJP2jg' =~ /^[a-zA-Z0-9]{12}-[a-zA-Z0-9]{9}$/
This question already has answers here:
Closed 12 years ago.
Possible Duplicate:
Java \ Pattern - how to write a pattern that verifies the lack of a string?
How can I match all strings without the word "authorize" in them via regular expressions? I tried *(authorize){0}* to no avail.
/^(?!.*authorize).*/
This uses a negative lookahead to ensure that the overall pattern will match only if the expression "authorize" cannot match anywhere in the input.