regex help section..

Discuss and share scripts and script files...
Post Reply
drjs5x
Posts: 152
Joined: 18 Nov 2015 18:12
Location: Turkey

regex help section..

Post 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.
newbie or not...........

highend
Posts: 13327
Joined: 06 Feb 2011 00:33
Location: Win Server 2022 @100%

Re: regex help section..

Post by highend »

There are a ton of ways to do this...

01.

Code: Select all

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

Code: Select all

regexreplace()
One of my scripts helped you out? Please donate via Paypal

drjs5x
Posts: 152
Joined: 18 Nov 2015 18:12
Location: Turkey

Re: regex help section..

Post 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:
newbie or not...........

highend
Posts: 13327
Joined: 06 Feb 2011 00:33
Location: Win Server 2022 @100%

Re: regex help section..

Post 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
One of my scripts helped you out? Please donate via Paypal

drjs5x
Posts: 152
Joined: 18 Nov 2015 18:12
Location: Turkey

Re: regex help section..

Post 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:
newbie or not...........

highend
Posts: 13327
Joined: 06 Feb 2011 00:33
Location: Win Server 2022 @100%

Re: regex help section..

Post 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 
One of my scripts helped you out? Please donate via Paypal

drjs5x
Posts: 152
Joined: 18 Nov 2015 18:12
Location: Turkey

Re: regex help section..

Post by drjs5x »

thanks dear.
i fixed alls.

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

Post Reply