RegEx match table cell -


regex question again

i'm using pcre syntax , i'm trying find solution matching cells in simplified table (like in trac)

let have:

||cell||cell||cell|| ||cell||cell||cell ||cell||||cell||     ||other table cell|| 

ok, need make 2 tables out of above, (second line misses ending, third has colspan=2 @ second cell)

the idea simple must catch every occurrence of ||cell i'm interested catch occurrences of | , text next occurrence of double | or new line, need avoid ! before pipes, , know distance beginning of line.

i spend whole day trying this... maybe i'm stupid... or maybe .net has verid implementation of regex.

this grabs content of every cell, you're talking about?

(?<=\|\|)[^|\r\n]* 

see demo

explanation

  (?<=                     # behind see if there is:     \|                     #   '|'     \|                     #   '|'   )                        # end of look-behind   [^|\r\n]*                # character except: '|', '\r' (carriage                            # return), '\n' (newline) (0 or more times                            # (matching amount possible)) 

Comments

Popular posts from this blog

commonjs - How to write a typescript definition file for a node module that exports a function? -

openid - Okta: Failed to get authorization code through API call -

thorough guide for profiling racket code -