Multiple Regular Expression

  • Thread starter Thread starter lltaylor
  • Start date Start date
L

lltaylor

Hello All,

I am writing a regex scanning app, I want to allow the user to be able
to enter multiple regular expressions.

Is there a way I can search for all the regular expressions in one
pass (of my file or direcotry) or do I have to instantiate a regex
object for each regular expression, ideally I need this to be done
dynamically.

Any suggestion would be appreciated.

Thnaks

Lloyd
 
lltaylor said:
Hello All,

I am writing a regex scanning app, I want to allow the user to be able
to enter multiple regular expressions.

Is there a way I can search for all the regular expressions in one
pass (of my file or direcotry) or do I have to instantiate a regex
object for each regular expression, ideally I need this to be done
dynamically.

Any suggestion would be appreciated.

Thnaks

Lloyd

You can try grouping the regular expressions and separate them with a |

For example, [a-z]* and [0-9]* might become
([a-z]*)|([0-9]*)

But you might want to try to compile each one first and make sure they
are well-formed before concatenating them like that.

John
 
Back
Top