0

Please fix the extract() function so flags will work

6replies Oldest first
  • Oldest first
  • Newest first
  • Active threads
  • Popular
    • Sean
    • Sean
    • 2 yrs ago
    • Reported - view

    I can't help myself 馃槇. Why would you use "i" or case insensitive mode when you are only extracting numbers?

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

    How do you avoid fixing something in version 2.7? 馃

    Like
  • Hi Sean, I think the function works just fine. Do you have a specific example? E.g.

    extractx("Hello", "[a-z]+", "", "Result: $0") => "Result: ello"

    extractx("Hello", "[a-z]+", "i", "Result: $0") => "Result: Hello"

    Best, Frank

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

    Hi Frank, here is an example...

     

    let myVar := "ABC123DEF456";
    extractx(myVar, "\D+", "g", "$0")

     

    If it worked similarly to Javascript match(), it would return "ABCDEF" because of the global flag.

    Like
  • The purpose of extractx is to retrieve the (first) matching part of the string, not the not-matching part. \D+ matches the digits.

    Like
    • Sean
    • Sean
    • 1 yr ago
    • Reported - view

    Hi Frank,

     

    Then there is no point in having flags in the function. The global flag works in the replacex function. I had the impression the functions with "x" at the end were Regex functions. If that's the case, then the "g" or global flag would cause the function to match all the characters in the string that are not numbers in this example.

     

    Gr眉脽e Sean

    Like
Like Follow
  • 1 yr agoLast active
  • 6Replies
  • 1237Views