+ 2

Pattern Regular Expressions

Suppose I have two words Frun and Run I want to write a regex pattern that only matches run not frun. Someone help me to write a pattern for that.... I would be kind enough.

1st Jun 2018, 11:49 AM
Abdul Basit
Abdul Basit - avatar
5 Antworten
1st Jun 2018, 12:18 PM
Calviղ
Calviղ - avatar
+ 9
Use this - /run/g or /run/gi for case insensitive for eg- var str = "run frun"; var patt= /run/g; var res= str.match(patt);
1st Jun 2018, 12:03 PM
Mohammad Amir Aqeel
Mohammad Amir Aqeel - avatar
+ 1
Thank you calvin so nice of you
1st Jun 2018, 2:11 PM
Abdul Basit
Abdul Basit - avatar
0
Use this site to try different patterns: https://regexr.com/3qd4k
1st Jun 2018, 12:13 PM
ODLNT
ODLNT - avatar
0
try this:"\b(?!F)Run\b"
4th Jun 2018, 5:31 AM
Cristian Baeza Jimenez
Cristian Baeza Jimenez - avatar