regex - Javascript: negative lookbehind equivalent? -
is there way achieve equivalent of negative lookbehind in javascript regular expressions? need match string not start specific set of characters.
it seems unable find regex without failing if matched part found @ beginning of string. negative lookbehinds seem answer, javascript doesn't have one.
edit: regex work, doesn't:
(?<!([abcdefg]))m
so match 'm' in 'jim' or 'm', not 'jam'
use
newstring = string.replace(/([abcdefg])?m/, function($0,$1){ return $1?$0:'m';});
Comments
Post a Comment