|
|
|
|
|
Re: Doubt on REGEXP_LIKE [message #624242 is a reply to message #624240] |
Fri, 19 September 2014 07:07 |
Lalit Kumar B
Messages: 3174 Registered: May 2013 Location: World Wide on the Web
|
Senior Member |
|
|
SQL> WITH CIF AS
2 (SELECT '2477882_COLL_1' AS VAL FROM DUAL
3 UNION ALL
4 SELECT '2794409_COLL_1' FROM DUAL
5 UNION ALL
6 SELECT '2291_Coll_1' FROM DUAL
7 UNION ALL
8 SELECT '2291' FROM DUAL
9 UNION ALL
10 SELECT '2291_a' FROM DUAL
11 UNION ALL
12 SELECT '2291_1_a' FROM DUAL
13 )
14 SELECT * FROM CIF
15 WHERE REGEXP_LIKE(VAL,'_[[:digit:]]')
16 /
VAL
--------------
2477882_COLL_1
2794409_COLL_1
2291_Coll_1
2291_1_a
Can you please explain why are you using ESCAPE?
|
|
|
|
Re: Doubt on REGEXP_LIKE [message #624255 is a reply to message #624253] |
Fri, 19 September 2014 10:27 |
Lalit Kumar B
Messages: 3174 Registered: May 2013 Location: World Wide on the Web
|
Senior Member |
|
|
@SY,
Either I am wrong or you have misinterpreted, because I just see "_" underscore as a wildcard character in OP's input. And I don't see a reason to use escape. Could you please explain where you think I am wrong, it would be good to know.
Thanks.
Edit : Regarding the regular expression, initially I thought of [0-9] class, but then I posted digit class. I would be happy to know why you think otherwise, since I have no clue from OP's input data.
[Updated on: Fri, 19 September 2014 10:32] Report message to a moderator
|
|
|
Re: Doubt on REGEXP_LIKE [message #624256 is a reply to message #624255] |
Fri, 19 September 2014 10:35 |
Solomon Yakobson
Messages: 3273 Registered: January 2010 Location: Connecticut, USA
|
Senior Member |
|
|
Did you read LIKE documentation. Like wildcards are % - any number of any characters and _ - any character. Without escape _2 means any character followed by digit 2 with escape it is underscore followed by digit 2.
SY.
|
|
|
Re: Doubt on REGEXP_LIKE [message #624257 is a reply to message #624256] |
Fri, 19 September 2014 10:43 |
Lalit Kumar B
Messages: 3174 Registered: May 2013 Location: World Wide on the Web
|
Senior Member |
|
|
Ok, got it, you mean to say " any character. Without escape". Actually I got confused when you said "Read what escape does and your regexp is wrong". I read it as a single statement.
Edit : In fact, I am sorry, I was the one who misinterpreted it.
[Updated on: Fri, 19 September 2014 10:47] Report message to a moderator
|
|
|
|
|