Re: [Interest] format of QString

2014-04-04 Thread sarah jones
Subject: Re: [Interest] format of QString From: kreios4...@gmail.com To: qtsa...@outlook.com CC: an...@familiesomers.nl; interest@qt-project.org You need to make a capture group by putting () around the expected text. Once you do that, you will get a list of size 1 from capturedTexts

Re: [Interest] format of QString

2014-04-04 Thread Keith Gardner
-- > From: qtsa...@outlook.com > To: an...@familiesomers.nl; interest@qt-project.org > Date: Fri, 4 Apr 2014 14:28:42 +0100 > > Subject: Re: [Interest] format of QString > > hi > I thought I 'escaped' the dot character by using \\. > is t

Re: [Interest] format of QString

2014-04-04 Thread sarah jones
.@outlook.com To: an...@familiesomers.nl; interest@qt-project.org Date: Fri, 4 Apr 2014 14:28:42 +0100 Subject: Re: [Interest] format of QString hi I thought I 'escaped' the dot character by using \\. is that not the case? Date: Fri, 4 Apr 2014 15:21:47 +0200 From: an...@familiesom

Re: [Interest] format of QString

2014-04-04 Thread sarah jones
hi I thought I 'escaped' the dot character by using \\. is that not the case? Date: Fri, 4 Apr 2014 15:21:47 +0200 From: an...@familiesomers.nl To: qtsa...@outlook.com; interest@qt-project.org Subject: Re: [Interest] format of QString sarah jones schreef op 4-4-

Re: [Interest] format of QString

2014-04-04 Thread André Somers
\d 6 times, but simply use [\\d]{6} instead. André Thanks Sarah > Date: Fri, 4 Apr 2014 13:58:10 +0200 > From: an...@familiesomers.nl > To: interest@qt-project.org > Subject: Re: [Interest] format of QString > > R. Reucher schreef op 4-4-2014 13:47: > > A sligh

Re: [Interest] format of QString

2014-04-04 Thread sarah jones
have tried this in some of the online regular expression tools and it seems to work there What have I got wrong? Thanks Sarah > Date: Fri, 4 Apr 2014 13:58:10 +0200 > From: an...@familiesomers.nl > To: interest@qt-project.org > Subject: Re: [Interest] format of QString > > R. Re

Re: [Interest] format of QString

2014-04-04 Thread André Somers
R. Reucher schreef op 4-4-2014 13:47: > A slight modification to your proposed reg-exp: > > QRegExp regExp("(m|c)_([0-9]{6})\\.rcp"); For new (Qt 5) code, I really recommend using QRegularExpression instead of QRegExp where possible. André > > Regards, René > > On Friday 04 April 2014 13:25:36

Re: [Interest] format of QString

2014-04-04 Thread R. Reucher
A slight modification to your proposed reg-exp: QRegExp regExp("(m|c)_([0-9]{6})\\.rcp"); Regards, René On Friday 04 April 2014 13:25:36 Etienne Sandré-Chardonnal wrote: > Hi sarah, > > This is untested but should work: > > QRegExp regExp("(m|c)_([0-9]{6}).rcp"); > if(regExp.exactMatch(fileNam

Re: [Interest] format of QString

2014-04-04 Thread Etienne Sandré-Chardonnal
Hi sarah, This is untested but should work: QRegExp regExp("(m|c)_([0-9]{6}).rcp"); if(regExp.exactMatch(fileName)) { //Here we know that filename matches the pattern QString letter = regExp.cap(1);//Will be "m" or "c" QString number = regExp.cap(2);//Will contain the six digi

Re: [Interest] format of QString

2014-04-04 Thread André Somers
sarah jones schreef op 4-4-2014 12:47: Hi How would you advise that I ensure a QString object is of a given format. In particular I want to check that a QString conforms to the following m_ or c_ followed by 6 digits (0-9) followed by ".rcd" so m_01.rcd matches as does c_03.rcd but not m

[Interest] format of QString

2014-04-04 Thread sarah jones
Hi How would you advise that I ensure a QString object is of a given format. In particular I want to check that a QString conforms to the following m_ or c_ followed by 6 digits (0-9) followed by ".rcd" so m_01.rcd matches as does c_03.rcd but not m_aa2.rcd etc Thanks Sarah