Problem with regex at start of line
Posted: Wed Feb 20, 2019 8:56 am
I am reasonably familiar with Regex and its implementation in LiveCode. I currently have a problem that relates to the start of string, i.e. using the caret: "^".
In the attached stack I am trying to remove all leading spaces from each line, using:
The caret should tell the code to remove spaces only at the start of lines and nowhere else. But it does not match any string. Removing the caret of course removes all spaces.
I could use more complex constructions, e.g. "char before is a return", but I want to keep it simple.
Grateful for any ideas.
Regards
Kaveh
In the attached stack I am trying to remove all leading spaces from each line, using:
Code: Select all
put replacetext( \
fld "Original", \
"(^ +)", \
"") \
into fld "Replacement"
I could use more complex constructions, e.g. "char before is a return", but I want to keep it simple.
Grateful for any ideas.
Regards
Kaveh