Regex for rise/rising | SoloLearn: Learn to code for FREE!

+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?

11/18/2018 2:48:02 AM

Farhan Ramli

2 Answers

New Answer

+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

0

ris(e|ing)