[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Regex help



--- Begin Message ---
Hi debian-users,

I am translating an O'Reilly book to French and the source code is in
FrameMaker format. The textual part is already translated but I still
have to translate the index entries. I have to be consistent and to
always use the same words across the document. As there are a great
number of line and numerous entries, I thought to using regexp to
extract the strings to translate in a file, add the translation next
to the strings and use sed to interpret this translation. It would be
a great gain for me.

My source file looks like :
----------------------------------------------------------------
Text {_Index blabla:we _} bla {_Index {_StartRange_} bla _} bla
vla
stuff
bbgfd {_Index {_EndRange_} bla _}
----------------------------------------------------------------

I would like to have this :
{_Index blabla:we _}
{_Index {_StartRange_} bla _}
{_Index {_EndRange_} bla _}

Or better:
blabla:we
bla
bla

or even better :
%s/blabla:we//g
%s/bla//g
%s/bla//g

So, I would just have to delete the strings not to be translated and
double strings, to insert translations and to feed sed with the file.

I am very bad in regex and I dont succeed. But I know regex can help
me a lot, reducing the amount of work and keeping consistency in the
translations.

Is there a regex expert here ? Please help me.

Thanks

Fanfan

PS: if it is done with a Perl program, it doesnt matter. Whatever the
way, I just want to have the output in the specified format.

--- End Message ---

Attachment: signature.asc
Description: Digital signature


Reply to: