Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #20057
    Paul99
    Participant

    Hi guys,

    I’m wondering if it is possible to do a find and replace with a wildcard, e.g. replace john* with tim

    I tried it but it doesn’t seem to recognise the *

    Cheers,

    Paul

    #20058
    Stefan
    Participant

    Hi Paul,

    please try Regular Expression, like

    Find: john.+?\b
    Replace: tim
    [X] Regular Expression

    Explanation:
    . (dot) >> match an single sign
    + >> match one-or-more of the expression just before (here: the dot)
    ? >> here: match non-greedy (only as much as need) . (depends which editor and which settings you use)
    \b >> match till an space is found

     

    #20066
    Paul99
    Participant

    Hi Stefan,

    This is working well, I have had a look at the regular expression syntax so I can see all the settings now,

    I am trying to match any term that contains (anywhere in the line) “.com”,

    so I have

    \.com.+

    This finds all the .com’s but I want it to select what is before the .com also, for example “hello.com” I want to look for .com then select select the whole hello.com not just .com.

    Best regards,

    Paul

    #20067
    Stefan
    Participant

    The solution depends on how your real world example off “hello.com” look like.
    For just “hello.com” search for \w+\.com
     
    Find: \w+\.com
    [X] Regular Expression
     
    Explanation:
    \w+ >> one-or-more (+) of “Any word character” (\w)
    \. >> literal dot
    com >> literal ‘com’
     
     
    Even just “\w+.com” will work, but can lead to unwanted results as we search for one any-sign (.) instead of a real literal dot (\.)
     
    More at the help > EmEditor Home – EmEditor Help – How to – Search >>> Regular Expression Syntax

Viewing 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.