I am trying to match a pattern which is like '12345@5.6;12345@45;12345@0.5'.I am trying to Oracle(11g) REGEXP_LIKE function to do that. Here is my code-
SET SERVEROUTPUT ON;
Begin
if regexp_like( TRIM('12345@5.6;12345@45;12345@0.5'),'[^\d+@((\d+.\d{0,4})|(\d+));$]+')
then
dbms_output.put_line('yes');
else
dbms_output.put_line('No');
end if;
end;
For the above code output is 'Yes' which is what i wanted.But this code is also returning 'yes' for pattern like '12345@5.6,12345@45;12345@0.5'(instead of semi colon I specified comma after '5.6').
It is basically checking for the pattern but if it finds at least one pattern of this kind this is returning true and not checking for the remaining string to make sure everything is in the pattern.
I want only patterns of the specified kind in the entire length of the string.If something is out of pattern I need to return 'No'.
Another eg:- For suppose there is a string 'abc;abc;abc' I want to check if pattern 'abc' not only exists in the string but also repeats itself through entire string. That means code should return false for strings like 'abc;bca;def' and should return true only for 'abc;abc;abc'.
To be clear,I just want to check if specified pattern is repeating through the entire length of string else I want to return 'No',not just see at least one exists and return true and I do not know how many times this pattern exist.
Hope I am clear,Please help.Thank you.