Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Beginning of line anchor doesn't seem to work in REGEXP_REPLACE #1

Open
bendavis78 opened this issue Jan 31, 2014 · 0 comments
Open

Comments

@bendavis78
Copy link

Here's a normal replacement, without any anchors (works fine):

mysql> SELECT REGEXP_REPLACE('ABCABC', 'A', '*');
+------------------------------------+
| REGEXP_REPLACE('ABCABC', 'A', '*') |
+------------------------------------+
| *BC*BC                             |
+------------------------------------+
1 row in set (0.00 sec)

If we add the beginning of line anchor, it fails to replace:

mysql> SELECT REGEXP_REPLACE('ABCABC', '^A', '*');
+-------------------------------------+
| REGEXP_REPLACE('ABCABC', '^A', '*') |
+-------------------------------------+
| ABCABC                              |
+-------------------------------------+
1 row in set (0.00 sec)

End of line anchor works fine:

mysql> SELECT REGEXP_REPLACE('ABCABC', 'C$', '*');
+-------------------------------------+
| REGEXP_REPLACE('ABCABC', 'C$', '*') |
+-------------------------------------+
| ABCAB*                              |
+-------------------------------------+
1 row in set (0.00 sec)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant