Jump to content

Regular expression failing to work with underscores


Axeia

Recommended Posts

Okay, I got a string like the one below.

[Ayako]​_Tayutama​_-​_03​_[XVID+MP3​_704x400][DAC23715].​mkv

And I got this in my database elsewhere:

[Ayako]_Tayutama_-_

Now I need the second string when used in a query to bring up the first one as a result, so I got my script to write the following string:

SELECT * FROM Unchecked WHERE Filename REGEXP( "\[Ayako\]_Tayutama_-_")

 

This does however not work, from some manual editting it seems it stops working as soon as the underscore is used.

SELECT * FROM Unchecked WHERE Filename REGEXP( "\[Ayako\]") works fine.

SELECT * FROM Unchecked WHERE Filename REGEXP( "\[Ayako\]_") does not

 

I thought it was a sqlite bug, but my Eclipse regex plugin runs into trouble with the underscore as well, what's so special about that underscore? Even this wont work:

SELECT * FROM Unchecked WHERE Filename REGEXP( "\[Ayako\].Tayu")

This  however does:

SELECT * FROM Unchecked WHERE Filename REGEXP( "\[Ayako\].+Tayu")

 

What's going on here?

That was my first approach, but ran into some problems as the second part would be some number matching where the number is greather than n.

Guess I'll just let PHP do some of the work and indeed let a LIKE handle the first part. Was hoping to do as much as possible in sql for ease of porting to other programming languages.

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.