0

What I'm looking to do is to highlight numbers that aren't in the middle of a word. The 001 in the following example should not highlight:

FrontSprite=trainer001b

But the 80 should in this example:

BaseMoney=80

Essentially, what this would mean is that any number should be highlighted if it is preceded or followed by a number.

I've been struggling a lot with this one. I'm very new to Regex and really can't find a working solution. This Regex would be used in Sublime Text 3.

M3rein
  • 187
  • 1
  • 13
  • 1
    `\b\d+\b`? Did you do any research? There are a lot of examples of this on stackoverflow and I see a new question identical to yours everyday. – ctwheels Sep 26 '17 at 17:45
  • `if it isn't preceded or followed by a number` - you mean by a non number? It's kinda hard to find a number that isn't a number – ctwheels Sep 26 '17 at 17:46
  • I've definitely done a lot of research. I just must've been using improper search tags. Thank you for your answer; works fine. – M3rein Sep 26 '17 at 17:47
  • `\D*\d+\D*` would come to my mind. – Jan Sep 26 '17 at 17:47
  • @Jan, Actually, that is not correct. You meant `(^|\D)\d+(\D|$)` or `(^|\D)\d+(?!\d)` or `(?<!\d)\d+(?!\d)` – Wiktor Stribiżew Sep 26 '17 at 17:55

0 Answers0