Replace all spaces with a dash (-) but with a certain limit !
-
Hello,
I would like to apply a change to a list containing several lines, by changing Space between words with a dash of (-) without touching
the rest of the words after (/).- Word1 word2 word3 word4 / word5 word6 word7 word8…
- Test1 test2 test3 test4 / test5 test6 test7 test8…
etc. (Hundreds of lines with different words)
by
- Word1-word2-word3-word4 / word5 word6 word7 word8…
- Test1-test2-test3-test4 / test5 test6 test7 test8…
etc.
Thank you in advance for your help.
-
Try a Regular Expression replacement, searching for
(?-s) (?=.*? /)
and replacing with-
. -
@Alan-Kilborn said in Replace all spaces with a dash (-) but with a certain limit !:
(?-s) (?=.*? /)
Thank you so much. It works very, very well ! :)
-
You’ve asked a few questions on the Community forum now. Here’s one for you: Do you see why what I gave you works?
-
Yes, most of the questions I ask on forum, you always find me beautiful solutions, and that helped me too much, and thank you so so much for your support.
-
I doubt he was fishing for another thank-you, though that was kind of you. :-)
What we really like to see is that the people we are helping are learning from our help, otherwise it makes us less eager to help an individual.
As a learning exercise, I suggest you trying to explain to us what the individual components of Alan’s regex are doing, and why that solves your problem.
If you need help, you can reference the official Notepad++ searching-using-regular-expressions docs, and maybe this forum’s regex FAQ.
Do your best trying to explain them. If you don’t understand what they are doing, give it a stab, and then ask us for clarification.
-
This post is deleted! -
This post is deleted! -
this lesson is well understood :)
I’m an amateur in website creation, and I have several pages under different names, that I have to put dashes (-) instead of Space and at the end of each line before the / I’ll add extension .html and the rest after (/) is the title of each page.