Grep expression to include carriage return if it's there


hi all,

 

is there grep expression able handle break return or other non-text character might or might not between pair of tabs?

 

i'm using grep within bbedit convert excel data tagged xml, import indesign. however, when has put carriage return within cell in excel, find/replace won't handle properly. can use workaround, didn't want amend original data if possible.

 

my expression looks 7 columns of text, , takes each piece , puts tags around them.

 

filename    |    full name    |    star    |    company    |    biog    |    city    |    twitter

 

johnsmith.tif    |    john smith    |    yes    |    deloitte    |    work @ deloitte , i'm brilliant.    |    new york    |    @myhandle

 

find:

^(.*?)\t(.*?)\t(.*?)\t(.*?)\t(.*?)\t(.*?)\t(.*?)$

 

replace:

<person>

<picbox href="file://headshots/\1" />

<name>\2</name>

<star>\3</star>

<company>\4</company>

<biog>\5</biog>

<city>\6</city>

<twitter>\7</twitter>

</person>

 

but if 1 of columns has break return others don't? - clear, might have carriage return, might not - tricky bit.

 

is there grep expression can account that?

 

johnsmith.tif    |    john smith    |    yes    |    deloitte    |    work @ deloitte

and i'm brilliant.    |    new york    |    @myhandle

 

if can help, amazing.

 

thanks,

 

justy

hi,

 

if want go greo, closest thing can think of

 

\t?[^\t]+\t?

 

but have cleaning.

 

otherwise, consider scripting given can export excel csv.



More discussions in InDesign


adobe

Comments

Popular posts from this blog

Reader DC

AdobeIDの作り方

Adobe InDesign CC 2017 has stopped working