Page 1 of 1

regex help section..

Posted: 16 Aug 2017 19:30
by drjs5x
hi dears.
i trying regex todays..

(\[VIDEO\]+?)(.*)(\.) > $1$3 --> spiderman 3[VIDEO] watched[VIDEO]Xvid.[Sound]AC3.test-01.mp4
result: spiderman 3[VIDEO].mp4 I SUCCESS THIS. but.

01) result must same "spiderman 3.mp4" "[VIDEO]" i cant remove :D :whistle:

02) how can regex search method in script.... ?

thanks dear coders.

Re: regex help section..

Posted: 16 Aug 2017 19:58
by highend
There are a ton of ways to do this...

01.

Code: Select all

(^[^\[]+)(.*\.)(.*) > $1.$3
02. By using

Code: Select all

regexreplace()

Re: regex help section..

Posted: 16 Aug 2017 20:10
by drjs5x
:whistle: dont work.

example:
spiderman 3[Sound]noremoveee[VIDEO] watched[VIDEO]Xvid.[Sound]AC3.test-01.mp4
result: spiderman 3.mp4
must result: spiderman 3[Sound].mp4
because must be after "[VIDEO]" not [] :)
thanks for trying...
:appl:

Re: regex help section..

Posted: 16 Aug 2017 20:17
by highend
01) result must same "spiderman 3.mp4"
That's what you've asked for and that's what my regex is doing...

To get

Code: Select all

spiderman 3[Sound].mp4
from

Code: Select all

spiderman 3[Sound]noremoveee[VIDEO] watched[VIDEO]Xvid.[Sound]AC3.test-01.mp4 
you could use:

Code: Select all

(^.*?\])(.*\.)(.*) > $1.$3

Re: regex help section..

Posted: 16 Aug 2017 20:30
by drjs5x
true.

spiderman 3[Sound]noremoveee[VIDEO]watched[VIDEO]Xvid.[Sound]AC3.test-01.mp4
spiderman 3[Sound]noremoveee.mp4 solution for this?
remove after first \[VIDEO\] word.
result is "spiderman 3[Sound]noremoveee.mp4"
regex difficult for my....
really thanks for all replies.
:appl:

Re: regex help section..

Posted: 16 Aug 2017 21:05
by highend

Code: Select all

(^[^\[]+)(\[(?:Sound|Video)\][^\[]+){1}(.*\.)(.*) > $1$2.$4
Would turn

Code: Select all

spiderman 3[Sound]noremoveee[VIDEO]watched[VIDEO]Xvid.[Sound]AC3.test-01.mp4
spiderman 3[VIDEO] watched[VIDEO]Xvid.[Sound]AC3.test-01.mp4 
into

Code: Select all

spiderman 3[Sound]noremoveee.mp4
spiderman 3[VIDEO] watched.mp4 

Re: regex help section..

Posted: 17 Aug 2017 19:46
by drjs5x
thanks dear.
i fixed alls.

(\[VIDEO\]+?)(.*)(\.) > $1$3
(?=\[VIDEO\])(.*)(\.) > $2