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?

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.