[Tutor] Help regarding reg exp.

Alan Gauld alan.gauld at yahoo.co.uk
Wed Oct 5 06:14:40 EDT 2016


On 05/10/16 10:03, rakesh sharma wrote:
> Hi all
> 
> I have a string of pattern ({A,BC},{(A,B),(B,C)(C,A)}. 

I'm not sure what you mean, can you send some real
examples of the data rather than just a generic pattern?

For example what do A,B and C signify? Are they literals?
Are they uppercase letters? Constant tokens? Something else?

> I want to extract the inner brackets {A,B,C} etc. 

You don't have a pattern like that in your string.
Do you mean the first term {A,BC}?
And should it really be {A,B,C}?

> Please help. I have tried various methods of re to no avail.

Until we understand the data better we can't be sure
a regex is the best solution.



-- 
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/
http://www.amazon.com/author/alan_gauld
Follow my photo-blog on Flickr at:
http://www.flickr.com/photos/alangauldphotos




More information about the Tutor mailing list