Quantcast
Channel: Regex for string contains? - Stack Overflow
Browsing index pages (6 articles)
↧

Regex for string contains?

What is the regex for simply checking if a string contains a certain word (e.g. 'Test')? I've done some googling but can't get a straight example of such a regex. This is for a build script but has no...

View Article


Answer by Platinum Azure for Regex for string contains?

Just don't anchor your pattern:/Test/The above regex will check for the literal string "Test" being found somewhere within it.

View Article


Answer by Michael Madsen for Regex for string contains?

Assuming regular PCRE-style regex flavors:If you want to check for it as a single, full word, it's \bTest\b, with appropriate flags for case insensitivity if desired and delimiters for your programming...

View Article

Answer by user2747691 for Regex for string contains?

I'm a few years late, but why not this?[Tt][Ee][Ss][Tt]

View Article

Answer by Kimball Robinson for Regex for string contains?

Depending on your flavor of regular expression - the exact details of regex capabilities vary depending on the language.I will give javascript examples.If you don't care about null safety...str =...

View Article


Answer by ACV for Regex for string contains?

For Java use this: ^.*Test.*$.It reads as: The string begins (^) then any character (.) can be repeated zero or more times (*) then Test and then again any character (.) repeated zero or more times (*)...

View Article
Browsing index pages (6 articles)


Latest Images