Reputation: 579
I have the following strings in the table:
activity_result.step1.desires
activity_result.step1.desires.one
activity_result.step1.desires.one.1
activity_result.step1.desires.two
activity_result.step1.desires.abs
activity_result.step5.habits
activity_result.step2.noroc
activity_result.step2.habits.ops
activity_result.step2.habits.ops.trei
I want to use REGEXP in MySQL to get just the following records:
activity_result.step1.desires
activity_result.step5.habits
activity_result.step2.noroc
I started with ^activity_result\.step([0-9]|[1-9][0-9])$
. Please help how to change the reg to get the desired result?
Upvotes: 0
Views: 94
Reputation: 7573
Looks like you want this:
So in regex that's
^activity_result\.step([0-9]|[1-9][0-9])\.[^.]+$
You can test this out over at https://regex101.com/
Paste in the regex, add the gm
modifier, and paste in your sample data and it will show you the matches.
Upvotes: 1