In Regex how to match in between the words?

Posted by user828234 on Stack Overflow See other posts from Stack Overflow or by user828234
Published on 2011-11-16T09:26:49Z Indexed on 2011/11/16 9:50 UTC
Read the original article Hit count: 112

Filed under:

I want to write the regex pattern which should match the string in between also.

For example:

I have writtenthe regex pattern like this

^((?!mystring).)*$

Which means match words which doesnot contain mystring. But i want regex pattern to match like this.

mystringabcdfrevrgf

regex matcher should return

abcdfrevrgf

How will i achieve this, Please help Thanks in advance.

Answer:

((?!mystring)(.*))$

© Stack Overflow or respective owner

Related posts about regex