cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

match_regex /

francisco_gaitan
Explorer
0 Kudos
3,647

HI

I am trying to find a pattern in my data,

the code is

match_regex(upper(CCLNAME), '^[A-Z][/].*', NULL)

I am trying to find the character '/' into the CCLNAME field.

Example

"N/E"

"HELP/US"

The problem is that all records are returning a "0" -- no match.

Thanks

Accepted Solutions (1)

Accepted Solutions (1)

francisco_gaitan
Explorer
0 Kudos

The problem is the character "/", if I replace for another character for example "!" the function return 1

Ejemplo

match_regex (UPPER('explan!tion'),'.[A-Z]*![A-Z]*',NULL) -> return 1

but

match_regex (UPPER('explan!tion'),'.[A-Z]*/[A-Z]*',NULL) -> return 0

match_regex (UPPER('explan!tion'),'.[A-Z]*\/[A-Z]*',NULL) -> return 0

match_regex (UPPER('explan!tion'),'.[A-Z]*\'/\'[A-Z]*',NULL) -> return 0

Thanks

Former Member
0 Kudos

I don't see any syntax error in the function. Could you try without UPPER and see? Also have you tried like this [-/()*#0-9a-zA-Z]* ? a dash '-' before the hash?

arun

francisco_gaitan
Explorer
0 Kudos

A friend helped me

The answer is

match_regex (CCLNAME,'(.)*\/(.)*','CASE_INSENSITIVE')

it works perfect.

Thanks for your time

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi,

If you want to find '/' only then use index() function, which is much easier.

index(CCLNAME,'/',1)

Arun

francisco_gaitan
Explorer
0 Kudos

HI,

Thank you, it is useful

I tried to use match_regex because then I need to find if the / has a "N" after or not, or before has a Consonant, or vowel, this part is easier, I can use [aeiou], but the "/" is the problem.

I found in the manual that use quotes if I want to use "/" as literal, but I couldn´t

I wrote match_regex(upper(CCLNAME), '^[A-Z][\''/\''].*', NULL) but didn´t work

DS 4.0

Thanks

Former Member
0 Kudos

Hi,

Try this

match_regex(upper(CCLNAME), ' [-/()*#0-9a-zA-Z]*',NULL)

Arun

francisco_gaitan
Explorer
0 Kudos

HI,

Thank you again.

It always return 0.

Example: CCLNAME = "PE/A" ->return 0

Former Member
0 Kudos

Instead of NULL could you try zero or just space ' ' and see.

Arun

francisco_gaitan
Explorer
0 Kudos

no, same return, I have been tried a lot of ways,