Hi All,
I am using a regular expression to find out whether the user entered value is alpha numeric, allowing some special characters.
I am using the following code which works fine:
CREATE OR REPLACE PROCEDURE Validate_Inputstring (input_String IN VARCHAR2) AS
BEGIN
IF REGEXP_LIKE(input_String,'^[A-Z0-9a-z,+-?@]*$') THEN
DBMS_OUTPUT.PUT_LINE('U have entered alphanumeric chars--->'|| input_String);
ELSE
DBMS_OUTPUT.PUT_LINE('U NOT have entered alphanumeric chars---->'|| input_String);
END IF;
END;
The above programs works fine.
Now my poblem is these special symbols are dynamic and these values vary upon the application.
In other words, these are stored in the database and different for each application.
For example, for application A these might be , + - ? @
, for B these might be { ^ & '
.
Is it possible to write a regular expression such that it checks for alphanumeric chars and these dynamic special symbols at a time?
I have tried something like
CREATE OR REPLACE PROCEDURE Validate_Inputstring (input_String IN VARCHAR2) AS
special_symbols VARCHAR2(300);
BEGIN
special_symbols :=',+-?';
IF REGEXP_LIKE(input_String,'^[A-Z0-9a-zspecial_symbols]*$') THEN
DBMS_OUTPUT.PUT_LINE('U have entered alphanumeric chars--->'|| input_String);
ELSE
DBMS_OUTPUT.PUT_LINE('U NOT have entered alphanumeric chars---->'|| input_String);
END IF;
END;
but it doesn't work. Does anyone have a solution for this? Thanks in advance!