Question

I'm trying to sort items generated by Yahoo Pipes from a CSV file by the last word of one of the entries of the generated items:

Example JSON item generated by this Pipe:

"items": [
  {
    "name": "Prof. Dr.-Ing. Richard Bamler",
    "link": "http:\/\/www.lmf.bv.tum.de",
    "lehrstuhl": "Lehrstuhl f\u00fcr Methodik der Fernerkundung",
    "y:row": "1",
    "description": null,
    "title": null
  },

I guess I need a RegEx to extract the last word of the name string (1st problem), which I can't quite figure out.

As always, thanks for your time.

Was it helpful?

Solution

I reworked your pipe a little bit. I'm not familiar with localized titles, but it appears that "komm." is a suffix rather than a name, so I built an exception into the end of the regex for that.

The rule should look like:

replace ^.* ([^ \.]+)( komm\.)?$ with $1


The $1 is a backreference to the first matched group ([^ \.]+). The matching group matches the last continuous set of characters that are not a space or period.

This form was necessary because the regex will run in a Javascript environment, and Javascript does not handle non-ascii characters like ü properly (it considers it a non-word).

It also has the ( komm\.)? at the end so that it can ignore that suffix, if present.

Beyond that, I made a couple of changes to clean up the output so it's a little more legible.

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