- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-11-2014 07:14 AM
Hi everyone,
I'm trying to make a regexp and the lookbehind seems to not work. Any idea?
var resolution = 'Servername: AZSXCD123DERFC' + '\n' + 'IP: 123.45.67.89'; gs.log('::'+ resolution.match(/(?<=servername:\s*)[^\n\r\t\v]+/i) + '::'); Evaluator: org.mozilla.javascript.EcmaError: Invalid quantifier ? Caused by error in script at line -1
but
var resolution = 'Servername: AZSXCD123DERFC' + '\n' + 'IP: 123.45.67.89'; gs.log('::'+ resolution.match(/servername:\s*[^\n\r\t\v]+/i).toString().split(' ')[1] + '::'); *** Script: ::AZSXCD123DERFC::
And obviously, I would like to not use the split function to have a secured way.
Regards,
Solved! Go to Solution.
- 6,022 Views
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-11-2014 08:41 AM
Regex! My love language! Kidding! From what I understand, there is no look behind in javascript's regex implementation.
javascript regex - look behind alternative? - Stack Overflow
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-11-2014 08:41 AM
Regex! My love language! Kidding! From what I understand, there is no look behind in javascript's regex implementation.
javascript regex - look behind alternative? - Stack Overflow
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-21-2014 04:43 AM
And in fact my lookbehind was wrong as well because I had (?<=servername:\s*), in lookbehind, we can only match a "predefined number of characters" (so no * or +...)