I’m working on some content that looks at a computer name to see if it’s relevant or not. Problem is, on the actual linux box I’m planning on running this, the regex always comes back false.
Windows QnA:
Q: exists matches (regex "^\w\w\d\d\d\w*\.") of "bb123bla.bl123.domain.com"
A: True
T: 0.103 ms
I: singular boolean
Did I find a bug or is there a difference where I can’t use this in LInux for some reason?
And yes I know there are simpler relevance ways of doing this, but this is a broken down simpler version of a much larger regex I’m working on… and this should just work anyway and its me off
I ran into this a while back and have a long thread on it here that I can try to find later. Basically it’s due to differences in the underlying regex libraries provides by the OS. The safest methods are to use only POSIX-compliant regular expressions rather than something like Perl-compatible regex. This gets ugly, but is doable.
Rather than expressions like “\w” for word and “\s” for whitespace, you have to use “[[:word:]]” and “[[:space:]]” if I recall correctly.
Yeah I’d expect that to work too. The main differences I saw were in shortcuts like \d and \w and \s. The AIX parser was even more strict than Linux (but I also had an older client version on AIX).