Andrei Freeman (lordandrei) wrote in ljgenie,
Andrei Freeman

  • Mood:

Okay... here's one with some gusto..

Wisest of LJGin,

Dearest of LJGenies....

I have a regular expression problem I'm trying to solve.

The first part was easy.. the second not so easy...

I'll put it behind a cut to spare people the code foo...

A note, my regex mechanism is an application called BBEdit. It's basically using greppy regex. Parens loop capture text, \n references the capture text in order of the parens.

I have the following text:
Do something
Do something else

Do this
Do That
Do something entirely different

Pattern repeats.

I've figured out the following without any problem:

As a result I can easily do:

The trick is I am shooting for
<tr class="foo"><td>\1<\td><td>\2<\td><\tr>

where foo is the heading (FOOO | GLAR) to allow me to format depending on which one.

Unfortunately this isn't quite working:

that clusters the entire unit but I have no way to step thru the individual captures of (now) \2 to distribute the \1 into the replace.

Confused? Ideas? Waaah!
Tags: awk, grep, question, regex

  • Okay, IANAL, but someone has to be...

    Oh wondrous LJ Genie, whose knowledge should only be used for the altruistic betterment of the world... I acknowledge very clearly I'm not a lawyer.…

  • Anti-Valentine's Day Songs?

    Dear LJ Genie who knows every piece of music ever written, You have never let me down. What are some really great anti-Valentine's Day songs? I have…

  • dress for excess?

    Dear LJ Genie who does crafts with the Fabric of Space & Time, I've got a satin formal gown left over from a long-ago wedding (they're still…

  • Post a new comment


    Anonymous comments are disabled in this journal

    default userpic

    Your reply will be screened

    Your IP address will be recorded 

  • 1 comment