[Solved] regex whitespace issue
I'm separately extracting the first and second numbers from the same input field using regexextract() which works, but I'm having trouble with the regex to account for whitespace being present or not.
I want it to work if it's typed with or without spaces:
1+1
1 + 1
Some versions (these also account for the numbers being integers or decimals):
Extract first number
regexextract(`Input`.text, "\d+(\.\d+)?")
regexextract(`Input`.text, "\d+(\.\d+)?\s?")
regexextract(`Input`.text, "\d+(\.\d+)?\s*")
Extract second number
regexextract(`Input`.text, "\+\s*(\d+(\.\d+)?)")
regexextract(`Input`.text, "\+\s?(\d+(\.\d+)?)")
regexextract(`Input`.text, "\s?\+\s?(\d+(\.\d+)?)")
regexextract(`Input`.text, "\+\s*(\d+(\.\d+)?)|\+(\.\d+)")
So far, everything I'm trying produces the same results:
https://cloud.protopie.io/p/3cef07ba7960247645ec3fec
How can I account for 1+1 and 1 + 1, or really any combination of whitespace and “+” sign? It’s pretty close.