Quantcast
Channel: CodeProject Latest postings for Regular Expressions
Viewing all articles
Browse latest Browse all 224

Regex before match

$
0
0
If I have string
12134944 toobad boys 12344444

I want to match "bad boys" and everything before and after bad boys until word boundary \b.
Something like this
"\\b.+?bad boys.+?\\b"

This returns
12134944 toobad boys 

and I want it to match "toobad boys"
I know that the problem is "\\b.+?bad" which matches everything up to "bad boys", but instead it has to match everything before "bad boys" until word boundary \b.

Help?

Viewing all articles
Browse latest Browse all 224

Latest Images

Trending Articles



Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>