Add delimiter - simple but not for begginer

  • Hello,
    I spend few hours looking for an answer, but didn’t find the solution. The idea how regular expressions works is too blur for me at this moment.
    I have a text like this : &&&&#&&Dublin1$$$$$#London2##$$$$Birmingham3$###
    Similar strings in each line, few hundred lines. I wanted to get string like that: Dublin1,London2,Birmingham3 - letter and digit combinations with delimiter added.

    In n++ I pressed Ctrl+H, in find field give regular expression (and marked the option of regular expressions): [a-zA-Z0-9]{1,15}
    But in the filed Replace I put many things from examples, like \1 etc. No result.

    Will be thankful for any help.

    Best regards,

  • @Alec-Tell :

    I would try:

    Find what: \W+
    Replace with: ,

    Meaning find a run of one or more NON-word characters and replace them with a comma.
    Word characters are [A-Za-z0-9_] so NON-word means everything else.
    Note the W is capitalized; that’s key to NON-word.

  • Thank you, looks so simple and elegant that makes me think where my “open minded” has gone.
    Will try it.

Log in to reply