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

  • Автор темы Автор темы neomatic
  • Дата начала Дата начала

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 ????
 
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
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) ?
 
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.
 
use -|-all at the end of your regex and it will give you all matches.
 
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.
 
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-}
 
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.
 

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