1

Here is my pipe: http://pipes.yahoo.com/pipes/pipe.info?_id=a732be6cf2b7cb92cec5f9ee6ebca756

I am currently trying to get the part before the first space to my item.url and the second part will be the title.

For instance, first item is:

http://carto1.wallonie.be/documents/terrils/fiche_terril.idc?TERRIL_id=1 Crachet 7/12

The expected result would be to get the "Crachet 7/12" as title and the other part as link.

My regex query "([^\s]+)" seem to work only for my first item, I don't understand why, as all the items are formatted the same way.

Thank a lot for any help!

EDIT: Pictures to understand better:

BEFORE REGEX enter image description here

AFTER REGEX enter image description here

Trying to check the g symbol enter image description here

Waza_Be
  • 39,407
  • 49
  • 186
  • 260

1 Answers1

1

You can use \S+ instead of [^\s]+. Also, you need to specify the "global" flag or the regex engine stops after the first successful match. In order to match only the first non-whitespace part of the line, use the ^ anchor with the "multiline" flag:

/^\S+/gm

or

new RegExp("^\\S+", "gm")

In your case, you need to check the appropriate checkboxes.

Tim Pietzcker
  • 328,213
  • 58
  • 503
  • 561
  • You may have a look at the pictures in first post to understand better... I hope that will be enough – Waza_Be Sep 29 '11 at 12:09
  • Check the "g" checkbox and try again. You might want to anchor the search to the start of the line, though, or all non-space text will be removed. See my edit. – Tim Pietzcker Sep 29 '11 at 12:13
  • By checking "g", everything is broken ( see third picture) – Waza_Be Sep 29 '11 at 12:26