1

Hello i need a regular expression per my sql query to match to text

"SIP/(10 NUMBERS)"

equals

"SIP/1234567890"

"SIP" are text and 10 number randoms 0-9

UPDATE

Final text are SIP/0123456789-000001cc

where

"SIP/" is text

"0123456789" Always 10 digits 

"-" is character 

"000001cc" is random alphanumeric
pedroooo
  • 563
  • 1
  • 4
  • 17

2 Answers2

1

You can use this regex:

^SIP/[[:digit:]]{10}-

Examples:

mysql> select 'SIP/0123456789-000001cc' regexp '^SIP/[[:digit:]]{10}-';
+----------------------------------------------------------+
| 'SIP/0123456789-000001cc' regexp '^SIP/[[:digit:]]{10}-' |
+----------------------------------------------------------+
|                                                        1 |
+----------------------------------------------------------+
1 row in set (0.00 sec)

mysql> select 'SIP/123456789-000001cc' regexp '^SIP/[[:digit:]]{10}-';
+----------------------------------------------------------+
| 'SIP/123456789-000001cc' regexp '^SIP/[[:digit:]]{10}-' |
+----------------------------------------------------------+
|                                                        0 |
+----------------------------------------------------------+
1 row in set (0.00 sec)
anubhava
  • 761,203
  • 64
  • 569
  • 643
  • Hello thanks for reply its work, please i updated my question per news directives can help me please? – pedroooo Aug 30 '16 at 14:08
0

Use \ to escape /

The following RegEx targets SIP followed by /and then 10 digit characters:

SIP\/\d{10}
Daniel
  • 10,641
  • 12
  • 47
  • 85