1

I'm building some regex expressions to match naming conventions in Sigasi Studio (which uses Java syntax for regex). For example, a port name must end in _i or _o - e.g. my_input_port_i

I tried using the txt2re generator, however instead of a simple expression it generated code.

Looking at regex syntax, it seems that the "$" character (end of line) and the "|" symbol (OR) could be helpful - something like $_i|_o but after testing with regex101.com no matches are found.

Naming convention dialog:

Sigasi Studio Naming Conventions

BenAdamson
  • 625
  • 3
  • 10
  • 19

2 Answers2

2

The $ means end of the string, but you use it at the beginning.

Maybe you are looking for this at the end of the string, which uses an underscore _, then a character class to match i or o and then matches the end of the string $

_[io]$

The fourth bird
  • 154,723
  • 16
  • 55
  • 70
  • Perfect, thanks. I was unaware that the "$" had to be at the end, my presumption was that the pseudocode of the syntax was: "at the end of the line, search for _i or _o" whereas it's actually "search for _i or _o then end of line" – BenAdamson Jan 26 '18 at 12:54
2

In Sigasi Studio the entire name should match. So your are looking for:

.*_[io]
Hendrik
  • 1,247
  • 7
  • 14
  • That works! Thanks for the Sigasi-specific advice. From this, I figure that prefixes are similar, for example to test if something starts with _u or _i you can do: [u|i]_.* – BenAdamson Jan 26 '18 at 13:03