xml - getting a substring out of a item in yahoo pipes -
following situation:
item. content => "this 48593 test" title => "the title" item. content => "this 48593 test 3255252" title => "the title" item. content => "this 35542 48593 test" title => "the title" item. content => "i havent 5 digits 34567654" title => "the title"
this current item in console of pipes
no want replace "content" "the last match of number has 5 digits. wanted result:
item. content => "48593" title => "the title" item. content => "48593" title => "the title" item. content => "48593" title => "the title" item. content => "" title => "the title"
is there way in pypes 2?
please comment if unclear
use regex module this:
in item.content replace (.*)
x $1
in item.content replace .*\b(\d{5})\b.*
$1
in item.content replace x .*
nothing (leave field empty)
some explanations
\d{5}
finds 5 digits\b
word boundaries, numbers more digits not found- the
x
@ beginning marks strings regular expression doesn't match delete them afterwards - finding last number , not first default behavior. because
*
greedy operator.
Comments
Post a Comment