help with find and replace (wildcards)
-
Hello, I am repairing some .srt files (subtitles for movies), but it’s tricky. Many different formats.
In text below, for example, I want to be rid of all {\pos(XXX,XXX.XXX), but I don’t know how to make that in notepad. I tried the wildcards of word and vba, no cigar.00:00:14,790 --> 00:00:21,770
{\pos(201.778,26.666)}战舰波将金号12
00:00:21,770 --> 00:00:25,200
{\pos(196,170.857)}高斯影业第一制片厂 出品13
00:00:25,200 --> 00:00:28,630
{\pos(196,195.857)}监制 J·M·布里奥克14
00:00:28,630 --> 00:00:32,180
{\pos(199,207.857)}编剧
N·F·阿加兹汉诺瓦·夏科15
00:00:32,190 --> 00:00:38,690
{\pos(196,225)}导演 S·M·爱森斯坦
副导演 G·亚力克山德罗夫人 -
@light-portal said in help with find and replace (wildcards):
I tried the wildcards of word and vba
Notepad++ does not use Word wildcards or VBA wildcards. It uses a flavor of regular expression (wildcards) known as “Boost regex”. This is documented in the official Notepad++ documentation, which can easily be found through the ? menu in Notepad++, in the entry called Notepad++ Online User Manual. There, you will see a whole page on Searching, with a section on Regular Expressions
Specifically, in the Find/Replae dialog, you will need to enable the SEARCH MODE = Regular Expression to enable the wildcard feature.
If i were you, I would search for FIND =
{\\pos.*?}. The\\is used because\has special meaning to regex, so you need it twice to “escape” it. The.*?means “find 0 or more characters, as few as possible”, so putting it between theposand the}means it will find up to the first}after thepos. The REPLACE would be blank, because you just want to delete those.-—
Useful References
-
@peterjones thank you
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better 💗
Register Login