1

I want to remove the dash from both ends of a pattern -L-07-TV-04-Clip-01- using Regex.

-L-07-TV-04-Clip-01-  
-I-have-to-realize-  
-me-having-this-addiction-  
-END-OF-CLIP-  
-L-07-TV-04-Clip-02-  
-I-have-to-realize-  
-when-I-felt-anger-  
-END-OF-CLIP-  
-L-07-TV-04-Clip-03-  
-I-have-to-realize-  
-when-I-have-shamed-others-  
-END-OF-CLIP-  
-L-07-TV-04-Clip-04-  
-I-have-to-realize-  
-when-I-have-shamed-myself-  
-END-OF-CLIP-  
-L-07-TV-04-Clip-05-  
-I-have-to-realize-  
-I-need-to-accept-  
-END-OF-CLIP-  

The expected formatting is:

  • Before Regex -L-07-TV-04-Clip-01-
  • After Regex L-07-TV-04-Clip-01
4
  • 1
    What is your question. The title is not the question. The body needs more than just your data. Commented Jun 21, 2022 at 3:34
  • ... and an example of the original text with correct line breaks (see formatting rules) and the expected result. Commented Jun 22, 2022 at 6:55
  • That is the correct formatting: Before Regex -L-07-TV-04-Clip-01- After Regex L-07-TV-04-Clip-01 Commented Jun 23, 2022 at 3:32
  • Welcome to Super User! For future use only because I did this for you in this one case - please edit your question to add some explanation or code instead of using comments as you did. Please read How to Ask a good question? Commented Jun 23, 2022 at 8:21

1 Answer 1

1

Lets say you have your clip titles in a text file line by line you'd go through following steps (quick and dirty solution):

  • Ctrl+H
  • Find what: (^-)(L-07-TV-04-Clip-[0-9]{2})(-$)
  • Replace with: $2
  • Search mode: Regular expression
  • Click on Replace All

results in:

enter image description here

2
  • Wonderful Thanks I needed to update it, to work on other TV-00, using what was provided (^-)(L-01-TV-[0-9]{2}-Clip-[0-9]{2})(-$) Commented Jun 25, 2022 at 19:45
  • @HHH-Messenger - Your welcome. If it was helpful please accept the answer and upvote. Commented Jun 25, 2022 at 19:49

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .