How to use wildcards with Replace ?



  • Hello, i would like to go from :

    ren Color_0001.jpg 18113434_ivia-rouge_armoire-etagere-n27
    ren Color_0002.jpg 18113437_ivia-rouge_armoire-frigo-n27
    ren Color_0003.jpg 18113444_ivia-rouge_armoire-rangement-n26
    ren Color_0004.jpg 18113565_ivia-rouge_armoire-rangement-n27

    to :

    ren Color_0001.jpg armoire-etagere-n27
    ren Color_0002.jpg armoire-frigo-n27
    ren Color_0003.jpg armoire-rangement-n26
    ren Color_0004.jpg armoire-rangement-n27

    ?



  • @Claudio-Gallego

    Maybe try:

    Bring up the Replace window (ctrl+h).
    Find what box: \d+_ivia-rouge_
    Replace with box: make sure this box is empty!
    Search mode: Regular expression
    Wrap around: ticked
    Press the Replace All button.



  • I’ve found something :

    search : jpg.*ivia-rouge
    replace : jpg

    With the “regular expression” mode activated.

    In fact, you need to put a dot . before the *



  • @Claudio-Gallego said:

    I’ve found something : search : jpg.*ivia-rouge

    That’s great if it works for you. But note that the regex as displayed does not work as advertised, because it is missing the underscores.

    For future readers of this thread, the forum gobbled the _ characters from @Claudio-Gallego’s regex. For the regex to work with the quoted data, it must be search = jpg.*_ivia-rouge_.

    To get it thru the forum without Markdown being applied to text, you need to enclose small pieces of exact text in back-ticks: `_ivia-rouge_` renders as _ivia-rouge_, instead of the italicized ivia-rouge that was seen without the proper Markdown. The PREVIEW window shows this. If you want to see more of the preview window at a time, hit the big black-circled ^ above the COMPOSE window.

    This forum is formatted using Markdown, with a help link buried on the little grey ? in the COMPOSE window/pane when writing your post. For more about how to use Markdown in this forum, please see @Scott-Sumner’s post in the “how to markdown code on this forum” topic, and my updates near the end. It is very important that you use these formatting tips – using single backtick marks around small snippets, and using code-quoting for pasting multiple lines from your example data files – because otherwise, the forum will change normal quotes ("") to curly “smart” quotes (“”), will change hyphens to dashes, will sometimes hide asterisks (or if your text is c:\folder\*.txt, it will show up as c:\folder*.txt, missing the backslash). If you want to clearly communicate your text data to us, you need to properly format it.


Log in to reply