Question

In Yahoo Pipes, titles of feed'items :

  • some words 23 january 2012 some words
  • some words 3 february 2012 some words
  • some words 04 july 2012 some words

I want to replace them by

  • 23 january 2012
  • 3 february 2012
  • 04 july 2012

I use regex

replace item.title ^.+(\d{1,2}.+\d{4}) with $1

But i obtain

  • 3 january 2012
  • 3 february 2012
  • 4 july 2012

I have no idea to solve my problem. If someone could help me. Thanks a lot

Was it helpful?

Solution

It looks like your first .+ is grabbing the first digit, because your capturing rule, \d{1,2} says grab 1 or two digits, and .+ can grab anything. Be more specific and put a \s+ before matching the digits.

Why not try:

.+\s+(\d{1,2}\s+\S+\s+\d{4})

OTHER TIPS

try to simplify your regex, for example \d{1,2}.+\d{4}

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top