问题
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
AFTER REGEX
Trying to check the g symbol
回答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.
来源:https://stackoverflow.com/questions/7596250/yahoo-pipes-and-regex-why-does-it-work-only-for-my-first-item