Question

Expression expects line breaks and spaces, but they couldn't appear too. 0 space possibility.

ENG\s+DOGS need to match:

ENG DOGS 

ENGDOGS 

ENG [line break]
DOGS
Was it helpful?

Solution

This will do it:

/ENG\s*DOGS/

Match the characters “ENG” literally «ENG»
Match a single character that is a “whitespace character” (spaces, tabs, and line breaks) «\s*»
   Between zero and unlimited times, as many times as possible, giving back as needed (greedy) «*»
Match the characters “DOGS” literally «DOGS»

OTHER TIPS

You need to use the * quantifier instead.

ENG\s*DOGS

Regular expression:

ENG           # 'ENG'
 \s*          # whitespace (\n, \r, \t, \f, and " ") (0 or more times)
 DOGS         # 'DOGS'

The following quantifiers are recognized.

*      Match 0 or more times
+      Match 1 or more times
?      Match 1 or 0 times
{n}    Match exactly n times
{n,}   Match at least n times
{n,m}  Match at least n but not more than m times
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top