-2

Can someone please help with making a regex expression to accomplish the following:

Match the string '55' that is not preceded by a '$' and not directly preceded or followed by another numeric digit.

Cant work out the lookarounds. The examples I've found like (?<!) aren't supported by online regex testers like regexpal.

Kdog
  • 503
  • 5
  • 20
  • 1
    What do you mean by "regex testers"? Are you going to use a "regex tester" in your code or `re`? What have you tried? – Wiktor Stribiżew Mar 24 '17 at 00:00
  • If you want to use online regex help tools, make sure to use [one that supports Python regexes](https://regex101.com/), and put it in Python mode. – user2357112 Mar 24 '17 at 00:02

2 Answers2

0

I think the regex you are looking for is just (?<!\$)55(?!\d).

BTW. I use regex101.com for online regex testing. It supports (?<!). Python's own library re also supports it.

Chuancong Gao
  • 654
  • 5
  • 7
0

Try this:

[^\$]55[^\d]

You can try online as mentioned.

MoustafaS
  • 1,991
  • 11
  • 20