GSQL matching using regular expression

Hi there,

I am trying to search for specific string pattern using regular expression using GSQL. It seems the best way is to define a UDF. Is there an example for doing so?

The only post I found relevant is the following where Richard Henderson was planning to blog about it.

Thanks,
John

Our published UDF library (the community one) has a regex searcher in it. I’d forgotten about that blog. Sorry about that. I have used the code in projects and it works well.

Concat should work into a variable assignment, though there can be some tricks needed. I’ll give it a go, and get back here.

2 Likes

Okay, I did this and it worked:

CREATE QUERY test_concat(STRING in_val) FOR GRAPH test { 
  /* Write query logic here */ 
  STRING new_string ;
  
  new_string = "%"+in_val+"%";
  
  PRINT new_string; 
}
1 Like