Macro Replace On Multiline while using wildcard.

General discussions about Advanced Find and Replace
Post Reply
jeffrey1790
Posts: 10
Joined: Tue May 29, 2007 3:10 pm

Macro Replace On Multiline while using wildcard.

Post by jeffrey1790 »

I would like to be able to do this:


Ex of text file.

#NOTES:
dance-single:
Renard:
Challenge:
109: <----------------(RATING)
0.840,0.925,0.279,0.192,1.000:
0000
0000
0000
0000


#NOTES:
dance-single:
Renard:
Hard:
93: <----------------(RATING)
0.840,0.925,0.279,0.192,1.000:
0000
0000
0000
0000


#NOTES:
dance-single:
Renard:
Medium:
46: <----------------(RATING)
0.840,0.925,0.279,0.192,1.000:
0000
0000
0000
0000


#NOTES:
dance-single:
Renard:
Easy
24: <----------------(RATING)
0.840,0.925,0.279,0.192,1.000:
0000
0000
0000
0000


Replace The Last digit from the number underneath Challenge, Medium, Easy or Hard and remove it completely.

NOTE: i will need to be able to replace over 400 of these located in seperate folders

link for example file:

http://www.jeffrey1790.com/children.sm

Thanks,
Jeff
jeff@jeffrey1790.com

Abacre
Site Admin
Posts: 1223
Joined: Mon Jan 31, 2005 5:32 pm

Post by Abacre »

It's possible to do with Advanced Find and Replace.
Question: what resulting text should be for your example?
Kind regards,
Abacre Limited
http://www.abacre.com
support@abacre.com

jeffrey1790
Posts: 10
Joined: Tue May 29, 2007 3:10 pm

Post by jeffrey1790 »

FINAL WHAT I WANT!

#NOTES:
dance-single:
Renard:
Challenge:
10: <------(NO DECIMAL)
0.840,0.925,0.279,0.192,1.000:
0000
0000
0000
0000


#NOTES:
dance-single:
Renard:
Hard:
9: <------(NO DECIMAL)
0.840,0.925,0.279,0.192,1.000:
0000
0000
0000
0000


#NOTES:
dance-single:
Renard:
Medium:
4: <------(NO DECIMAL)
0.840,0.925,0.279,0.192,1.000:
0000
0000
0000
0000


#NOTES:
dance-single:
Renard:
Easy
2:<------(NO DECIMAL)
0.840,0.925,0.279,0.192,1.000:
0000
0000
0000
0000

Abacre
Site Admin
Posts: 1223
Joined: Mon Jan 31, 2005 5:32 pm

Post by Abacre »

Go to main menu - Action - Options - Batch Replace
check "Modifier S"

Go to Batch replace tab, check on "Use regular expressions".
Put into the grid, search for:
(#NOTES:\r\ndance-single:.*\d+)\d:
Replace with:
$1:

That's all I verified it works perfectly.
Kind regards,
Abacre Limited
http://www.abacre.com
support@abacre.com

jeffrey1790
Posts: 10
Joined: Tue May 29, 2007 3:10 pm

Post by jeffrey1790 »

at the bottom of the window it says 0 files of 456 and doesnt work.

Abacre
Site Admin
Posts: 1223
Joined: Mon Jan 31, 2005 5:32 pm

Post by Abacre »

Please send a sample file to support@abacre.com
It's probably a problem of trailing spaces.
Kind regards,
Abacre Limited
http://www.abacre.com
support@abacre.com

jeffrey1790
Posts: 10
Joined: Tue May 29, 2007 3:10 pm

Post by jeffrey1790 »

i sent the sample file

Abacre
Site Admin
Posts: 1223
Joined: Mon Jan 31, 2005 5:32 pm

Post by Abacre »

Thank you for the file.
Yes, indeed, it was a problem of trailing spaces before dance-single: text

Therefore use Search For:
(#NOTES:.*\d+)\d:
Last edited by Abacre on Wed May 30, 2007 8:09 pm, edited 1 time in total.
Kind regards,
Abacre Limited
http://www.abacre.com
support@abacre.com

jeffrey1790
Posts: 10
Joined: Tue May 29, 2007 3:10 pm

Post by jeffrey1790 »

and replace with $1: right?

jeffrey1790
Posts: 10
Joined: Tue May 29, 2007 3:10 pm

Post by jeffrey1790 »

HOLY CRAP..........I LOVE THIS PROGRAM! THANKS

Abacre
Site Admin
Posts: 1223
Joined: Mon Jan 31, 2005 5:32 pm

Post by Abacre »

Exactly, replace it with $1:

In fact $1 will take text located between () in Search For part.
and : is a separator after last digit defined by \d
Kind regards,
Abacre Limited
http://www.abacre.com
support@abacre.com

Post Reply