Use regex to find a substring with hyphen -
i'm new @ regex character matching , need regex not match substring sl-t , character t . regex character t cannot detect t character in substring sl-t . have looked @ other questions , nothing has helped me. close can before negating expression.
(sl-t)|(t)
any appreciated!
edit
using javascript regex.
here small portion of data. lines except 1,4, , 6 need matched expression.
t //1 w-r t-sb t //4 st sl-t //6 sl tsge sr st
^(?!(?:sl-)?t$)
starting @ beginning of line, uses negative lookahead make sure string not consist of optional "sl-" , letter "t" followed end of string.
Comments
Post a Comment