jeudi 30 mars 2017

Choosing delimiters for multiple regex string in one string [c++11]

Firstly, those regex are for matching table columns, i.e. FirstName, LastName, EmployeeId, XXX_Name, YYY_Name, etc.

I need to construct a single string which contains multiple regex like this:

pattern1,pattern2,~pattern3

the ',' is for delimeter regex patterns, and '~' means not matching.

So above string means:

  1. One of the table columns matches pattern1, and
  2. One of the table columns matches pattern2, and
  3. None of the table columns matches pattern3

But, ',' is one of the special chars for regex, I'm not sure if '~' is also.

Could you suggest what're the best candidates for the delimiters? Or an alternative solution for this?


I'm considering '\n' and ';'. '\n' I know it should be safe enough.

But ';' not sure if it is one of the regex special char, do you know?

I checked this doc Regular Expression Reference, but even ',' ({m,n} case) is not documented there.

Aucun commentaire:

Enregistrer un commentaire