Skip to Content
avatar image
Former Member

Split string using Regular Expression

Hi,

I want to split a string like below

OTHER!@!1000-01-01!@!N!@!TEST EXPLANATION' -- KEYWORD!@!ACCOUNT!@!MANSYS!@!EXCLUDEEXPLANATION

I want to split the string where it has !@! using regular expression.

Please help me.

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

1 Answer

  • Jul 20, 2015 at 08:17 AM

    Hi,

    You do not need regex for this.

    Refer this StackOverflow page, they've addressed the same issue: http://stackoverflow.com/questions/27709088/hana-split-string

    In that page they've used comma "," as the delimiter, you can use "!@!" instead.

    By the way, if you are getting this data from elsewhere, like from a Java program or Python script etc, think about doing the splits there. Most languages have some sort of String.split() function that will be easier than creating a procedure in HANA.

    Regards,

    Suhas

    Add comment
    10|10000 characters needed characters exceeded

    • Splitting is not possible using the regex functions provided in HANA. The regex functions in SAP HANA are available in the documentation.

      Regexes won't help you do what you are intending, but if you want examples of regex you can refer the documentation on this functionality.