Hi
I have a series of values in a record column as such:
01|02|03|
Now, I want to select a record that contains a specified value.
If I used a LIKE expression such as
where the value I'm searching for is '01|', I would eventually be getting false positives from values like '101|','301|' etc.
So my question is - if I use MySQL's REGEXP feature to select the value, would it be possible to construct the expression as such:
where the value I'm searching for is 01| and I want to find it either at the beginning of the string, or preceded by a '|' then any sequence of characters?
Would the '^' signifying the beginning of the string be valid in the 'or' condition?
Any help would be appreciated.
I have a series of values in a record column as such:
01|02|03|
Now, I want to select a record that contains a specified value.
If I used a LIKE expression such as
Code:
SELECT * FROM table WHERE column LIKE "_01|%"
where the value I'm searching for is '01|', I would eventually be getting false positives from values like '101|','301|' etc.
So my question is - if I use MySQL's REGEXP feature to select the value, would it be possible to construct the expression as such:
Code:
SELECT * FROM table WHERE column REGEXP ".*(^|\|)01\|.*"
where the value I'm searching for is 01| and I want to find it either at the beginning of the string, or preceded by a '|' then any sequence of characters?
Would the '^' signifying the beginning of the string be valid in the 'or' condition?
Any help would be appreciated.