java regex to exclude specific strings from a larger one -
I have been beaten for the time being against my head: 0-9]? Character sequences, except strings like sin | Cos | Tan
etc. After doing my Reggae homework, the following regex should work:
(? ((Sin | reason | tan))) \ b [az] [0-9]?
As you see, I'm alternatively using negative letter head - after the non-capturing group ending bracket \ b
after < Code> in sin
etc. Regex is understandable and in reality I am trying as a target implementation with Reggaebudby and Java and getting the desired results, but it does not work by using Java Matcher and Pattern Objects! \ b
Also, exclude the strings like negative attitudes (if this will work) cost
, which I'm not sure you want to do is just keyword Are filtered.
I recommend:
\ b (?? sin \ b | cos \ b | tan \ b) [az] + [0- 9]? \ B
Or, more just, you just \ b [az] + [0-9]? \ B
and you can filter the strings later in the keyword list. You do not always have to do everything in regex.
Comments
Post a Comment