So if you want the exact same semantic, it'll become far more complicated than this regex.
I agree. That's a good point. Thank you !
In other words it is not easy to design a good trim function without regex, but it is possible to design one that used regex, but treating the single quoted string as a special case
For example
trim(' ',$line)
vs
trim(/\s/.$line)BTW this is impossible in Python which implements regex via library, unless you add a new lexical type to the Language (regex string instead of raw string that is used).
In reply to Re^2: How to trim a line from leading and trailing blanks without using regex or non-standard modules
by likbez
in thread How to trim a line from leading and trailing blanks without using regex or non-standard modules
by likbez
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |