Thread: regex from plperl
Hi, I've written following function: create or replace function dewey(text) returns text as ' $_=shift; if (/(\d\d\d)/) { return "$1"; } else { return("this is not a valid dewey!"); }' language plperlu; Then: libri=# select dewey('432'); dewey ---------------------------- this is not a valid dewey! (1 row) It seems that regex doesn't work at all. But regex are quite important for me. Is There something that I've forgotten? Best wishes, \fer --
"Ferruccio Zamuner" <nonsolosoft@diff.org> writes: > create or replace function dewey(text) > returns text > as ' > $_=shift; > if (/(\d\d\d)/) { > return "$1"; > } else { > return("this is not a valid dewey!"); > }' language plperlu; You need to double the backslashes. regards, tom lane