Parsing multiple match in a row (separate by a coma)

neomatic

Client
Регистрация
27.10.2011
Сообщения
64
Благодарностей
8
Баллы
8
Parsing many matches on different line can be good sometimes, but how to store in a file the whole result on a line ????
 

gcomm

Client
Регистрация
01.03.2011
Сообщения
332
Благодарностей
93
Баллы
28
Put the execution result of each parse step in a single macro of "append lines to file" and separate with a comma..


{execution-result1},{execution-result2},{execution-result3},{execution-result4},{execution-result5}
 
  • Спасибо
Реакции: neomatic и bigcajones

neomatic

Client
Регистрация
27.10.2011
Сообщения
64
Благодарностей
8
Баллы
8
Thank you gcomm,
That's a solution when the number of result is stable and repeatable.

But in my case, i can have 2 to 30 results randomly.
I tried to make a loop with a counter or with a temporary store file to increment the loop. but i'm block it's not yet working.
Do you know if there's a string to get the value of number of results match (like i can get the counter value) ?
 

neomatic

Client
Регистрация
27.10.2011
Сообщения
64
Благодарностей
8
Баллы
8
I actually found a template with a loop to add result by a coma. Youpee !

But to set up the number of loop before to exit, I really need a way to get the counter of matches found.
In the Regular expression builder, the test button give you the number of match. How to get this max value of match with a macro ?

All help is appreciate.
 

bigcajones

Client
Регистрация
09.02.2011
Сообщения
1 216
Благодарностей
683
Баллы
113
use -|-all at the end of your regex and it will give you all matches.
 

neomatic

Client
Регистрация
27.10.2011
Сообщения
64
Благодарностей
8
Баллы
8
Not bad.
But I need the number of match. Not all the results.
I'm gonna try to record All in a file and get the number of string contained in the file.
 

Hungry Bulldozer

Moderator
Регистрация
12.01.2011
Сообщения
3 441
Благодарностей
834
Баллы
113

neomatic

Client
Регистрация
27.10.2011
Сообщения
64
Благодарностей
8
Баллы
8
I wish to have a function for this, but I did something else.
Record All in a file and get the number of string contained in the file.
Then because match 0 is the first result, i needed to remove 1.
I just follow the advise of Hungry Buklldozer using JS execute macro {-JS.Execute-|--}
like this: {-JS.Execute-|-{-File.CountOfStrings-|-\Results\Temp2.txt-}-1-}
 

Stereomike

Client
Регистрация
29.03.2011
Сообщения
221
Благодарностей
30
Баллы
0
You don't need to write it to a file, just use -count of strings- on your regexp. It's only one medium complex macro then.

Edit: Just tried, it's like that:
{-String.SplitCount-|-{-RegExp.RegExp-|-{-File.GetBlock-|-\_projects\stuff.txt-|--|-0-|-false-}-|-(?<=I\/)[\w\W]*?(?=\.jpg)-|-all-}-|-{-String.Enter-}-}

What it does:

{-File.GetBlock-|-\_projects\stuff.txt-|--|-0-|-false-}
Gets your raw data

{-RegExp.RegExp-|-RAWDATA-|-(?<=I\/)[\w\W]*?(?=\.jpg)-|-all-}
Get me a list of jpgs, everything from rawdata that looks like that: 'i/*******.jpg'

{-String.SplitCount-|-LISTofJPGS-|-{-String.Enter-}-}
Count the amount of entries, delimiter is linefeed(enter)


All in one go.
 

Кто просматривает тему: (Всего: 1, Пользователи: 0, Гости: 1)