February 28th, 2013, 09:33 AM
Complex (for me) string manipulations
I am trying to write a script that modifies tables in Wiki markup (not that that really matters) without changing the rest of the page content. The make up of my string is as follows.
1) Text preceding a table
2) A table
3) Text following the table
4) If another table then 2)
5) else done
That is essentially how I want to split the string. A table start is identified by a double vertical bar or pipes (||). There are many pipes (including double pipes) in the table to denote cells and the end of a row is denoted by a pipe and new line. The real problem (for me) is finding the end of the table. When a row ends (|\n) and other than white space and pipe is found, the table has ended. But this is after the fact.
I could use some help figuring out how to construct the logic for this. I can find the start of a table with index and the double pipe then split the string at that point for 1). What I don't know how to do is find the last pipe of that table without running into the first pipe of the next table. Once I do that I'm home free as I can just look for the double pipe again in what is left of the string. TIA
There are 10 kinds of people in the world. Those that understand binary and those that don't.
Last edited by gw1500se : February 28th, 2013 at 11:18 AM.