regex - Repeative Matching Group -


i struggling following: change pattern "","" result.

source:

customer number     customer name       price       group status 100001              test customer       retail      active 

output:

"customer number","customer name","price group","status" "100001","test customer","retail","active" 

this: (.*?)\t match last , there no tab. try capture last group throws off first group repetitive matching.

you can try lookaround : (^|\t)(.*?)(?=\t|$) group between (start of sentence or tab \t) , (tab \t or end of sentence)

regex demo

result

customer number customer name price group status  100001 test customer retail active 

Comments

Popular posts from this blog

Sort a complex associative array in PHP -

vb.net - How to ignore if a cell is empty nothing -

recursion - Can every recursive algorithm be improved with dynamic programming? -