Jump to content

Weird Regex question


Ortix

Recommended Posts

Sorry for such a bad title, i'm not sure how i can describe this problem  :shrug:

 

So here's the thing:

 

I have this string:

[sHiN-Remux][MSPN-SUBS] Ore-tachi ni Tsubasa wa Nai - 01 [1280x720 h.264 AAC][FB36073E].mkv

 

I want it to look like this:

Ore-tachi ni Tsubasa wa Nai 01 

 

Currently it looks like this:

Ore 01

 

The reason is that I am using regular expressions and other functions to filter out the stuff i don't need. Most of my strings come in this form:

 

Titleoftheshow - 01

 

Which is totally fine since this does work.

 

Rarely do they appear like this:

title-of-theshow - 01

or even this (which makes things more complicated)

 title - of - the - show - 01

 

Now the problem is that after the FIRST dash, everything is deleted. How could i escape all the dashes in that are in between letters and only remove the dash that's between a letter and a NUMBER.

 

Daunting task eh? I have tried several things but i just can't come up with a solution.

Link to comment
https://forums.phpfreaks.com/topic/232858-weird-regex-question/
Share on other sites

whoops sorry about that. not sure where that came from but yeah. I would like to get

 

Ore-tachi ni Tsubasa wa Nai 01

 

Without the dash between the Nai and 01

 

I put that in my initial post :)

 

Maybe it can be done by finding the dash between a string and a number? Or perhaps the last instance of that character in the string?

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.