Waza_Be
Waza_Be

Reputation: 39538

Yahoo Pipes and regex: Why does it work only for my first item?

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

Upvotes: 1

Views: 494

Answers (1)

Tim Pietzcker
Tim Pietzcker

Reputation: 336128

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.

Upvotes: 1

Related Questions