It is currently November 13th, 2018, 3:33 am

Little help with RegEx again...

General topics related to Rainmeter.
LeftSide
Posts: 35
Joined: July 3rd, 2012, 6:16 pm

Little help with RegEx again...

LeftSide » November 21st, 2012, 5:16 pm

So I have a list

Code: Select all

Work
Work
Fire
Global
And I want just the first letters from each line.

Code: Select all

WWFG
The list is created by a batch script

Code: Select all

echo %1>>
I've tried this

Code: Select all

([a-z])[^\n]+\n*
but it gives me just an F
User avatar
moshi
Posts: 1851
Joined: November 13th, 2012, 9:53 pm

Re: Little help with RegEx again...

moshi » November 21st, 2012, 6:59 pm

try:

Code: Select all

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

repeat the

Code: Select all

(?(?=.*\n).*\n(.))
as often as you need.
LeftSide
Posts: 35
Joined: July 3rd, 2012, 6:16 pm

Re: Little help with RegEx again...

LeftSide » November 21st, 2012, 7:06 pm

Thanks. BTW
moshi wrote:repeat the

Code: Select all

(?(?=.*\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...[/strike]

Nvm. It works flawlessly.