CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Perl Programming Help: Regular Expressions: Re: [cybex] Syntax for string variances in Perl: Edit Log



Laurent_R
Veteran / Moderator

Nov 30, 2013, 10:45 AM


Views: 49736
Re: [cybex] Syntax for string variances in Perl


In Reply To
@Laurent_R: Thank you for the help, but that expression did not work for all of the requirements.


Well, you could make the effort to say which requirement it does not match.

This is the test I've just made under the Perl debugger:


Code
  DB<3> x @c 
0 '"S "'
1 'S: '
2 'S2:'
3 'SUBJECT:'
4 'SUBJECT 3:'
5 '(S)'
6 '(S4)'
7 '(SUBJECT)'
8 '(SUBJECT 5):'
9 '"SUBJECT "'
DB<4> @d = grep {m/^\(?"?S(\s|: |\d:|\)?)|UBJECT|\d?\)?\s?"?/} @c

DB<5> x @d
0 '"S "'
1 'S: '
2 'S2:'
3 'SUBJECT:'
4 'SUBJECT 3:'
5 '(S)'
6 '(S4)'
7 '(SUBJECT)'
8 '(SUBJECT 5):'
9 '"SUBJECT "'


So the regular expression pattern I gave you seems to be matching every single one of the nine items in my @c array, which presumably reflects exactly the requirement you posted. Now, it could be that you added somewhere a space that I cannot see since you did not use code tags, or changed something. Or maybe it is matching too much. But then please explain exactly what you think does not work.


(This post was edited by Laurent_R on Nov 30, 2013, 10:52 AM)


Edit Log:
Post edited by Laurent_R (Veteran) on Nov 30, 2013, 10:52 AM


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives