Regex for getting yahoo groups account

A swapping-ground for Regular Expression syntax

Regex for getting yahoo groups account

Postby tasima » Thu Apr 09, 2015 10:21 am

hi

I have strings that contain the url of an yahoo group and it may appear in any of the following patterns:
Code: Select all
it.groups.yahoo.com/group/batmaras/links/
it.groups.yahoo.com/group/batmaras/links
it.groups.yahoo.com/group/batmaras/
it.groups.yahoo.com/group/batmaras
I need a regex that can always capture the "batmaras" (I can't guess that part, I need to extract it using regex) and give me a result as follows:

Code: Select all
it.groups.yahoo.com/group/batmaras


I want to remove anything after the "batmaras" part.

this is what I tried and is not working for me:
Code: Select all
(it\.groups\.yahoo\.com\/group\/.*?)\/?
tasima
 
Posts: 1
Joined: Thu Apr 09, 2015 10:17 am

Re: Regex for getting yahoo groups account

Postby bitmonger » Thu Apr 09, 2015 6:06 pm

I may be missing something, but why don't you use something simple like:

Match:
(.+batmaras).*

Replace:
\1

Hope this helps,
Bit
Last edited by bitmonger on Mon Apr 13, 2015 6:17 pm, edited 1 time in total.
bitmonger
 
Posts: 50
Joined: Sat Sep 22, 2007 5:05 am

Re: Regex for getting yahoo groups account

Postby Stefan » Thu Apr 09, 2015 8:44 pm

Only that "Bulk Rename Utility" is for renaming file NAMES, not contents like that text file of tasima :D

But that provided solution may still work if he use a good test editor like SynEdit, Notepad2, Notepad++ or PSPad.

But maybe he have to use $1 as replacement expression instead of \1, depending on the used editor.


.
Stefan
 
Posts: 736
Joined: Fri Mar 11, 2005 7:46 pm
Location: Germany, EU

Re: Regex for getting yahoo groups account

Postby bitmonger » Mon Apr 13, 2015 6:23 pm

Stephan is completely right, Bulk Rename is only used to change the name, not the contents of files. I was so focussed on the regular expression I forgot to mention that. As he suggested, the expression should still work used in the appropriate editor.
bitmonger
 
Posts: 50
Joined: Sat Sep 22, 2007 5:05 am

Re: Regex for getting yahoo groups account

Postby Admin » Tue Apr 14, 2015 2:27 am

Thank you bitmonger.... we much appreciate the help you are willing to provide to other users of BRU. Only with people willing to help like yourself this user's forum can be useful.
Thank you to Stephan too for the continued support you provide and have provided to other users. thanks
Admin
Site Admin
 
Posts: 2343
Joined: Tue Mar 08, 2005 8:39 pm

Re: Regex for getting yahoo groups account

Postby annaya » Fri Apr 17, 2015 8:24 am

But that provided solution may still work if he use a good test editor like SynEdit, Notepad2, Notepad++ or PSPad.
__________________
emma
annaya
 
Posts: 1
Joined: Fri Apr 17, 2015 8:19 am


Return to Regular Expressions