i have a multi-line matching case in javascript that
seems it should be something like /(?<=.+)\\n(?!#)/m
but javascript does not support lookbehind, how can i write this regex?
You can't. A typical trick to get lookbehind is to temporarily reverse the string and act on that, but that only works when there is no lookahead as well. See http://blog.stevenlevithan.com/archives/mimic-lookbehind-javascript for some other possibilities including one which supports lookbehind and lookahead (but not expressed as a single regex)--see the section "Mimicking lookbehind using a while loop and regexp.lastIndex".
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.