skip to main content

kiesler.at
YahooPipesRegex
Back to Page | Back to History

Difference between revisions

Version 7, 2008-06-27 13:10 Version 8, 2008-06-28 13:41
Lines 11 - 28 Lines 11 - 39
**Please note**: Like in the Yahoo Pipes discussions, I put RegEx patterns within square brackets. That way, you can distinguish for example [] and [ ] easily. Please omit the square brackets unless noted otherwise. **Please note**: Like in the Yahoo Pipes discussions, I put RegEx patterns within square brackets. That way, you can distinguish for example [] and [ ] easily. Please omit the square brackets unless noted otherwise.
   
   
+++ The Checkboxes +++ The Modifiers
   
What do the four checkboxes mean next to each RegEx line? The answer is taken from the [http://discuss.pipes.yahoo.com/Message_Boards_for_Pipes/threadview?bn=pip-DeveloperHelp&tid=3410&mid=3414 Yahoo Pipes Discussions]. You might have noticed four checkboxes next to each RegEx line. Those are used for modifying the way the RegEx behaves and succeeded the so called "embedded pattern-match modifiers". But they did not completely replace them.
   
  In fact, you can use the modifiers "I, M, S and X" in embedded notation, while the checkboxes offer the options "I, M, S and G". So there's no X for checkboxes while there's no G for the embedded notification.
   
  The answer is taken from the [http://discuss.pipes.yahoo.com/Message_Boards_for_Pipes/threadview?bn=pip-DeveloperHelp&tid=3410&mid=3414 Yahoo Pipes Discussions].
   
  **What they do**
   
* **g** allow global matches. set=match every occurence; unset=match only first occurence. * **g** allow global matches. set=match every occurence; unset=match only first occurence.
* **i** be case insensitive. set='A' equals 'a'; unset 'A' and 'a' are treated differently * **i** be case insensitive. set='A' equals 'a'; unset 'A' and 'a' are treated differently
* **m** treat string as multiple lines. set='^' matches every start of string after a \n and/or \r . unset='^' matches only the very first character in the string. * **m** treat string as multiple lines. set='^' matches every start of string after a \n and/or \r . unset='^' matches only the very first character in the string.
* **s** allow '.' to match new lines as well. set='.' matches '\n'. unset='.' does not match '\n'. * **s** allow '.' to match new lines as well. set='.' matches '\n'. unset='.' does not match '\n'.
  * **x** allow white spaces and comments within an expression.
   
  **Embedded Notation**
   
  [http://discuss.pipes.yahoo.com/Message_Boards_for_Pipes/threadview?m=te&bn=pip-DeveloperHelp&tid=4415&mid=4415&tof=131&frt=2#4415 Hapdaniel] from the Yahoo Pipes Discussions points out, the original form of specifying those flags is the "embedded notation". If you prefix your RegEx with a (?x), you'll set the X-modificator. You cannot set a (?g) that way, though.
   
**Alternate Notation** **Checkbox Notation**
   
[http://discuss.pipes.yahoo.com/Message_Boards_for_Pipes/threadview?m=te&bn=pip-DeveloperHelp&tid=4415&mid=4415&tof=131&frt=2#4415 Hapdaniel] from the Yahoo Pipes Discussions points out, that there is an alternate form of specifying those flags as well. you can for example prefix your RegEx with a (?g) to get the +g flag set. To activate one of the checkbox-flags, just tick it. You can tick as many flags as you like. Except the X-flag, which apparently is not available as checkbox.
   
   
+++ Common patterns +++ Common patterns
Lines 96 - 104 Lines 107 - 126
   
Sometimes, you'd like to add something in front of a field. For example, to add a "Yahoo: " in front of every title, you could Sometimes, you'd like to add something in front of a field. For example, to add a "Yahoo: " in front of every title, you could
   
* Replace [(.*)] with [Yahoo: $1] * Replace [^] with [Yahoo: $1]
   
  $1 matches the first group used (we have only one group in this example). And ^ matches the beginning of the expression.
   
  Source:
   
   
  **Postfixing something**
   
  And to suffix something, you'd use a $ instead of the ^.
   
  * Replace [$] with [Yahoo: $1]
   
$1 matches the first group used (we have only one group in this example). Source:
   
   
**Translating dates** **Translating dates**