Reminds me of this xkcd
Ahem, in case you don’t need it anymore, please send me that Awk book
Nyet! ;-{)
But you can pick up a used copy for around 14 bucks U.S.:
-Chris
Hey Chris,
Are you by chance russian? Or just like the word
Nyet...
-Chris
Your regex expression ^(.*?\/r\/[^\/i]+)
is matching the part you wish to retain.
If you search & replace and replace that part with nothing, then all you have left is the part you don't want.
You could use a Search Variable action instead which lets you pick out the matching parts.
or alternatively you can search and replace and match the entire string and keep only the first component.
To All:
Chris is just being modest.
He IS the premier Regular Expression expert.
Many thanks, Chris, for all the help you have given me and others to help us learn/use RegEx.
Having been there, done that, I can attest to this key learning point.
I have hacked many a RegEx, and learned little.
It was only after I committed to memory the key RegEx syntax, AND started CREATING my own RegEx that I got over that initial hump, and could start becoming productive in the creation/use of RegEx.
To that end, there are several good RegEx cheat sheets out there.
Here is one by Chris (click here).
It is a great guide, but initially, it may still be overwhelming.
So, I suggest that you build you own cheat sheet.
As you learn a new syntax/expression, add it to your sheet.
By definition, it will be a list of the expressions that you use most often, so it will be a short list (at least for a while).
The act of writing the expression down, will help you remember it.
In your list, put a link to other cheat sheets/tutorials, like the one by Chris.
Then when you need to create a new RegEx, goto RegEx101.com and try to create the expression from memory. Allow yourself at least 2 or 3 attempts. Then, if you still can't get it, go to YOUR cheat sheet. If that doesn't give it to you, then go to Chris' cheat sheet.