(direct link) Conditional Replacement using a Replacement Pool I'll show you two similar idea (using a replacement pool or a dictionary) and some variations. You'll also need an editor with strong regex capabilities, such as EditPad Pro or Notepad++. Note that this technique will only work in flavors that allow you to set a capture within a lookahead. The purpose of this page is to show you a trick I came up with that allows you to do just that. You can insert new text, you can insert text matched by capture groups, but there is no syntax for conditional insertion, e.g, inserting bleu if you matched blue-at least not in any of the tools I know. In a text editor, however, it's a different story. From this light, regex replacements are really flexible. In fact, if you wanted you could compute replacements by talking to a NASA server and requesting a piece of data from a machine on the moon. (Depending on context, such functions may be called lambdas, delegates or callbacks.) Using regex, this is no problem is most programming languages, where you can call a function to compute replacements.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |