View unanswered posts | View active topics It is currently September 2nd, 2014, 1:49 am



Reply to topic  [ 3 posts ] 
 Little help with RegEx again... 
Author Message

Joined: July 3rd, 2012, 6:16 pm
Posts: 35
Post Little help with RegEx again...
November 21st, 2012, 5:16 pm
So I have a list
Work
Work
Fire
Global


And I want just the first letters from each line.
WWFG


The list is created by a batch script
echo %1>>


I've tried this
([a-z])[^\n]+\n*
but it gives me just an F

Profile
User avatar

Joined: November 13th, 2012, 9:53 pm
Posts: 1587
Post Re: Little help with RegEx again...
November 21st, 2012, 6:59 pm
try:

(?siU)(?(?=.)(.))(?(?=.*\n).*\n(.))(?(?=.*\n).*\n(.))(?(?=.*\n).*\n(.))



repeat the
(?(?=.*\n).*\n(.))

as often as you need.

Profile

Joined: July 3rd, 2012, 6:16 pm
Posts: 35
Post Re: Little help with RegEx again...
November 21st, 2012, 7:06 pm
Thanks. BTW
moshi wrote:
repeat the
(?(?=.*\n).*\n(.))

as often as you need.
In this approach, if I don't know just exactly how many times I need to use it in advance it sometimes gives me nothing at all...


Nvm. It works flawlessly.

Profile
Display posts from previous:  Sort by  
Reply to topic   [ 3 posts ] 

Who is online

Users browsing this forum: Google [Bot] and 3 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by STSoftware.