0

Add Regular Expression Capability

It would be really useful if you added the ability to use regular expression for conditional statements.

3replies Oldest first
  • Oldest first
  • Newest first
  • Active threads
  • Popular
  • These functions already exist:

     

    replacex(string, pattern, flags, replace) – Replaces occurances of pattern in string with replace. Pattern is a regular expression string, flags is also a string specifying how the match takes place. Replace is a string, optionally using argument expressions. This call is compatible to JavaScript’s

    string.replace(new RegExp(pattern, flags), replace)

    Learn more at: Javascript RegExp.

    replacex("Hello World", "l", "g", "X") => "HeXXo WorXd"

     

    Split a string with a regular expression: splitx("Hello World", "\s") => ["Hello", "World"]

    testx(string, regular_expression, flags) => boolean
    testx(string, regular_expression) => boolean
    extractx(string, regular_expression, flags, extract); extracts a substring from the given string
    extractx(string, regular_expression, extract); extracts a substring from the given string
    extractx(string, regular_expression); extracts a substring from the given string

    Leo

    Like
  • Thank you for this information. I missed this in the documentation. I'm used to looking at it from a conditional checking statement vs a specific function.

    Like
    • Sean
    • Sean
    • 2 yrs ago
    • Reported - view

    @Leonid,

     

    Have you ever gotten "flags" to work in extractx()? Beyond capture groups, what does the "extract" argument represent and how do you access it. If you have an example where "flags" works, would you please post it. Thanks

     

    Sean

    Like
Like Follow
  • 2 yrs agoLast active
  • 3Replies
  • 1841Views