Regex for rise/rising | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Regex for rise/rising

text = rise rising risi pattern to match only rise and rising. Must not match risi. I try pattern ris[e(ing)] and match rise and risi What is wrong there?

18th Nov 2018, 2:48 AM
Farhan Ramli
Farhan Ramli - avatar
2 Answers
+ 2
The pattern you wrote will match rise, risi, risn, risg. When you use square brackets it's like saying "match ANY of the characters inside the sqare brackets. What you need is: | Regex you need is: ris(e|ing). What is in paslranthesis means match: e OR ing Read more about regex: https://stackoverflow.com/questions/4736/learning-regular-expressions
18th Nov 2018, 8:43 AM
Gabriel Vasile
Gabriel Vasile - avatar
0
ris(e|ing)
18th Nov 2018, 4:11 AM
N00B