Click here to Skip to main content
15,917,709 members
Please Sign up or sign in to vote.
2.00/5 (1 vote)
See more:
Hello all,
I'm wondering what the specific code would be to do the following:

Split a string into 40 regular expressions (I guess in an array of strings?).
Loop over each of those 40 strings and split each of THOSE into 2 expressions.

Any specific code help would be appreciated (especially on the looping parts). Thanks in advance.

Suraci
Posted
Updated 28-Oct-10 1:01am
v2
Comments
OriginalGriff 28-Oct-10 7:07am    
Going to depend on what your original string contains.
What are the regexes separated by?
What are the expression pairs separated by?
Edit your question and provide more info.
Hiren solanki 28-Oct-10 7:42am    
what could be the final output you want by doing such a hardwork, put some idea further.
Abhinav S 28-Oct-10 8:06am    
Not quite sure what you are looking for.

1 solution

It sounds like you don't need regex at all. Normally you would use regex to perform searching, matching or selecting of defined regex patterns but that isn't the case here. To split strings you can simply use String.Split.

Split comma separated values to an array of strings:
string[] words = s.Split(',');

You could then split those strings in the array again if needed. This is very simple and no need to use any regex for that.

Good luck!
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900