We need to mimic “AND” functionality using look ahead expression (?=expr). See the construct below:


This functionality works in Java/Phyton/Perl/PHP and many other languages, however it might not be available in JavaScript. Check latest JS specification and let me know if this has changed.



Will match:
111-234 sometext 3D Demo

Will not match:
1113-223 sometext 3D Demo
If you would not use \b at the end and start of the expression, it would also match the above line.

Read also:


Would love your thoughts, please comment.x