Skip to Content
1
Former Member
Jun 20, 2014 at 09:04 AM

RegEx [ \

37 Views

I am playing/learning with regular expressions in a rule.

Currently I am looking at how to handle escapable characters.

On the surface it looks easy, simply escape the following with a backslash:

* ? + [ ( ) { } ^ $ | \ . /

I have all but the square bracket working ....

BEGIN

IF( LENGTH($parameter0) >0)

BEGIN RETURN

match_regex($parameter0, '[^\*\?\+\(\)\{\}\^\$\|\\\/]*', NULL);

END

ELSE RETURN FALSE;

END

However, if I add \[ to the expression, it validates, but then fails when using the 'test' function:

match_regex($parameter0, '[^\*\?\+\(\)\{\}\^\$\|\\\/\[]*', NULL);

Data Services execution failed for [-Knproftsid0, -Knprofrnid-1, -Knprofprid-1, -Knprofsrun0, -Knprofprll, -Knprofvrn14261, -z"C:\ProgramData\SAP BusinessObjects\Data Services\log\errorLog_JOB_TEST_RULE_55_547474632693261.txt", -CSV"$$InformationStewardDSTaskUniqueID=MF8w;", -CSV"$$ISRunID=LTQyOTQ5NjcyOTY;", -CSV"$$sv_task_subrun=MF8w;", -sJOB_TEST_RULE_55, -ForceEngineRuntimeToUTF16]. Error :

(14.2) 06-20-14 05:01:39 (E) (2780:8864) RUN-050319: |Data flow DF_TEST_RULE_55|Transform Query2|Function BBAC4705-8825-462C-B19D-A57FA2047747_Local Invalid value <[^\*\?\+\(\){}\^\$\|\\/[]*> passed for pattern parameter in function <m>. (COR-10690)

Any ideas as to what I am doing wrong ??

Thanks