About EasyMorph Tutorials & Examples Web-help

Regular expression action Mode "First match only" + Capture Mode "Groups only"

Hello,

In the Regular Expression action, having the possibility to chose “Groups only” in “First match only” could be interesting. Sometimes I only want to extract the first capture group that is found in a regular expression, not all of them. And in the scenario where I have a regular expression which has several capture groups and I choose “All matches” mode and Capture mode “groups only”, then EasyMorph created new lines per row (so that there’s the same number of lines as possible capture groups), independently of the number of capture groups found. In a regex with 2 possible capture groups, the row where there’s a match will be duplicated, even though only one of the two capture groups has been actually found (in one row the group will be extracted, and the other row will be blank). In this case, it would interesting to have only 1 row, where there’s the group that was actually found. Why does it add another row when the second capturing group has not been found? Could this be solved by adding the “Capture mode” menu to Mode “First match only”, and being able to select here “Groups only”?

image

Thanks very much,

Roberto

To learn more about EasyMorph visit easymorph.com.