Tokenize a string with escaping: Difference between revisions
Content added Content deleted
m (Sidef comes before Simula (once again!)) |
m (→{{header|Sidef}}: fixed output) |
||
Line 2,123: | Line 2,123: | ||
Regex(esc.escape + '.(*SKIP)(*FAIL)|' + sep.escape, 's'), -1 |
Regex(esc.escape + '.(*SKIP)(*FAIL)|' + sep.escape, 's'), -1 |
||
) |
) |
||
fields.map{.gsub(Regex(esc + '(.)'), {|s1| s1 }) } |
fields.map{.gsub(Regex(esc.escape + '(.)'), {|s1| s1 }) } |
||
} |
} |
||
Line 2,129: | Line 2,129: | ||
say str.dump |
say str.dump |
||
}</lang> |
}</lang> |
||
{{out}} |
|||
{{out}} NOTE: the output is different from the one given in the task |
|||
<pre> |
<pre> |
||
"one |
"one|uno" |
||
"" |
"" |
||
"three |
"three^^" |
||
"four |
"four^|cuatro" |
||
"" |
"" |
||
</pre> |
</pre> |