in reply to Can anyone make this regex job neater?

Just for the sake of having a one-liner:
s#^(OBX\|[^|]+\|)([^^]*)#$1 . join("",map( { s/([A-Z])/U$1/ || s/([a-z +])/L$1/; $_ } split //,$2)) #e; OBX

s$$([},&%#}/&/]+}%&{})*;#$&&s&&$^X.($'^"%]=\&(|?*{%.+=%;.#_}\&"^"-+%*).}%:##%}={~=~:.")&e&&s""`$''`"e

Replies are listed 'Best First'.
Re^2: Can anyone make this regex job neater?
by cLive ;-) (Prior) on Oct 11, 2005 at 21:31 UTC
    lol - mine turned out incredibly similar:
    s#^(OBX(?:.*?\|){2})([^^]+)#$1.join'',map{/[A-Z]/?"U$_":/[a-z]/?"L$_": +$_}split'',$2#e;
    And no, I didn't read yours first :)

    cLive ;-)

      So let's go for another one:
      $_="OBX|NM|aaA..^Haem^RD2|7.5|g/dL|13.0-18.0|OR|";s#^(OBX\|[^|]+\|)([^ +^]*)#$1 . join("",map( { my $x=$_; y/A-Z/U/ || y/a-z/L/; "$_$x" } spl +it //,$2)) #e
      Update: 2 downvotes? Would be nice to know why.

      s$$([},&%#}/&/]+}%&{})*;#$&&s&&$^X.($'^"%]=\&(|?*{%.+=%;.#_}\&"^"-+%*) +.}%:##%}={~=~:.")&e&&s""`$''`"e