Re: Converting with Regular Expressions

new topic     » goto parent     » topic index » view thread      » older message » newer message
_tom said...
useless said...
{ {},   `<a href="http:`    ,    `">A LINK</a>`  } ,  

I too am curious. I did notice that leaving out {} makes things not work.

Will the author of transmute() please help out?

man:std_sequence#transmute

TFM said...

By default, this routine operates on single elements from each of the arguments. That is to say, it scans source_data for elements that match any single element in current_items and when matched, replaces that with a single element from new_items.

For example, you can find all occurrances of 'h', 's', and 't' in a string and replace them with '1', '2', and '3' respectively. transmute(SomeString, "hts", "123") However, the routine can also be used to scan for sub-sequences and/or replace matches with sequences rather than single elements. This is done by making the first element in current_items and/or new_items an empty sequence.

Emphasis added.

I didn't write the routine, but I guess the author chose this somewhat awkward method over a separate routine or additional flag.

Matt

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu