Link to home
Start Free TrialLog in
Avatar of psionic086
psionic086Flag for Czechia

asked on

How to code repeated regular expresion in VB.net for xml files

Hello I am looking for a solution to simple VB.net coding issue.
The problem is easy to explain but difficult to code for novice like us.

We are making translation program in VB.net fot xml reporting files. Our
reporting database already include translation expression for every word which should be translated in our reports, which looks like: code.translate("WordToBeTranslated")
We have already decoded it into phase which get us back all WordToBeTranslated list from whole report. But only if textbox contain exactly one code.translate expression. We are using nodes and node list with regular expression.

This regular expresions and matching in VB code looks exactly like this:

New Regex("^=code.Translate\(\""(.*)\"")$"), RegexOptions.IgnoreCase)

m= pattern.Match(label)

So, if theres more than one code.translate, program gets back everything from first "quote" to the latest quote and is unable to detect each expression separately.

Please if you can give me any advice how to resolve this, I can really appreciate it ;)
Thanks,
Vojtech
Avatar of crysallus
crysallus
Flag of Australia image

This should probably help you understand what's going on, and give you a method to fix it (better than me simply giving you the solution as this way you're more likely to understand the solution).

http://www.regular-expressions.info/repeat.html
ASKER CERTIFIED SOLUTION
Avatar of kaufmed
kaufmed
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Forgot the question mark for Example 1:

    New Regex("^=code.Translate\(\""(.*?)\"")$"), RegexOptions.IgnoreCase)