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

Popular posts from this blog

python - No exponential form of the z-axis in matplotlib-3D-plots -

php - Best Light server (Linux + Web server + Database) for Raspberry Pi -

c# - "Newtonsoft.Json.JsonSerializationException unable to find constructor to use for types" error when deserializing class -