User Tools

Site Tools


cookbooks:3.2.x:transformations

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
cookbooks:3.2.x:transformations [2011/10/18 18:50]
miconda created
cookbooks:3.2.x:transformations [2018/07/12 08:31] (current)
gaaf [{re.subst,expression}]
Line 6: Line 6:
 </code> </code>
  
-[b]Transformation[/b] is basically a function that is applied to a pseudo-variable (PV) to get a special value from it. The value of PV is not altered.+**Transformation** is basically a function that is applied to a pseudo-variable (PV) to get a special value from it. The value of PV is not affected at all.
  
 Transformations are implemented by various modules, most of them being in **pv** module. Transformations are implemented by various modules, most of them being in **pv** module.
Line 12: Line 12:
 The transformations are intended to facilitate access to different attributes of PV (like strlen of value, parts of value, substrings) or complete different value of PV (encoded in hexa, md5 value, escape/unescape PV value for DB operations...). The transformations are intended to facilitate access to different attributes of PV (like strlen of value, parts of value, substrings) or complete different value of PV (encoded in hexa, md5 value, escape/unescape PV value for DB operations...).
  
-A transformation is represented in between [b]'{'[/b] and [b]'}'[/b] and follows the name of a PV. When using transformations, the PV name and transformations [b]must[/b] be enclosed in between [b]'('[/b] and [b]')'[/b].+A transformation is represented in between **'{'** and **'}'** and follows the name of a PV. When using transformations, the PV name and transformations **must** be enclosed in between **'('** and **')'**, following the **$** sign.
  
 <code> <code>
Line 177: Line 177:
 </code> </code>
  
 +==== {s.replace,match,repl} ====
 +
 +Replace all occurrences of **match** with **repl**. The parameters can be pseudo-variables.
 +
 +Example: 
 +<code c>
 +$var(x) = "abababa";
 +$(var(x){s.replace,a,c} => "cbcbcbc"
 +</code>
 +
 +==== {s.ftime,format} ====
 +
 +
 +Format the epoch in the pv according to the parameter. The parameter has to be strftime formatting string.
 +    
 +<code c>
 +$(TS{s.ftime,%Y-%m-%d %H:%M:%S})
 +</code>
 ===== URI Transformations ===== ===== URI Transformations =====
  
Line 189: Line 207:
 ==== {uri.host} ==== ==== {uri.host} ====
  
-(same as [b]{uri.domain}[/b])+(same as **{uri.domain}**)
  
 Return the domain part Return the domain part
Line 322: Line 340:
 ===== To-Body Transformations ===== ===== To-Body Transformations =====
  
-<hi #c0c0c0>This transformation class is exported by **pv** module.</hi>+<fc #0000ff>This transformation class is exported by **pv** module.</fc>
  
 Access parts of a ToBody-like structure. Access parts of a ToBody-like structure.
Line 353: Line 371:
 ===== Regular Expression Transformations ===== ===== Regular Expression Transformations =====
  
-<hi #c0c0c0>This transformation class is exported by **textops** module.</hi>+<fc #0000ff>This transformation class is exported by **textops** module.</fc>
  
  
 ==== {re.subst,expression} ==== ==== {re.subst,expression} ====
  
-Perform Perl-like substitutions on string value pseudo-variables.+Perform POSIX regex substitutions on string value pseudo-variables.
  
 <code c> <code c>
Line 385: Line 403:
 ===== SQL Transformations ===== ===== SQL Transformations =====
  
-<hi #c0c0c0>The transformations in this class are exported by the **sqlops** module.</hi>+<fc #0000ff>The transformations in this class are exported by the **sqlops** module.</fc>
  
 ==== {sql.val} ==== ==== {sql.val} ====
Line 436: Line 454:
 </code> </code>
  
-* Test if whether is un-registration or not+* Test whether is un-registration or not
  
 <code> <code>
cookbooks/3.2.x/transformations.1318956616.txt.gz ยท Last modified: 2011/10/18 18:50 by miconda