0

Can someone help me to fix this regex to use in javascript?

(?<!\\\\)#\\{{1,2}

Regex tester said:

SyntaxError: Invalid regular expression: /(?:((?<!\\)#\{{1,2})|(.))/: Invalid group

Thanks.

4
  • javascript won't support lookbehinds. Commented Mar 21, 2015 at 0:16
  • can you help me remake it? i don't have any experience with regex :( it was for slim-template hightlighting in texmate. '#embedded-ruby': [ { token: 'punctuation.section.embedded.ruby', regex: '(?<!\\\\)#\\{{1,2}' Commented Mar 21, 2015 at 10:34
  • replace (?<!\\) with (?:^|[^\\]) Commented Mar 21, 2015 at 10:35
  • SyntaxError: Invalid regular expression: /(?:((?:^|[^])#\{{1,2})|(.))/: Unterminated character class Commented Mar 24, 2015 at 11:53

1 Answer 1

1

maybe /(?:((?!\\)#\{{1,2})|(.))/. in python negative lookback is (?<!...) but in javascript is (?!...) just remove <

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.