Re: Regex problem.




Quoth Ash <ashishrai@xxxxxxxxx>:
A B B c A c B d A A

I have a string as represented above. They are separated by spaces of
unknown length. I need to match As and Bs and store them in array in
the order they occur, or as they occur. The array filled from above
string should contain: ABBABAA.

The split function on spaces cannot be used because A,B and Cs are
representative of bigger string which may itself contain spaces for
example A may represent "clever fox" and B may represent "jumps over"
in which case the sequence ABB becomes "clever fox jumps over clever
fox",so space cannot be used as delimiter.
Global matching also cannot be used because it doesn't give me the
order different pattern occur.

Err... it does for me:

~% perl -le'$_ = "clever fox jumps over foo bar clever fox";
print for /(clever fox|jumps over)/g'
clever fox
jumps over
clever fox
~%

Ben

.



Relevant Pages

  • Re: Regex problem.
    ... I have a string as represented above. ... unknown length. ... I need to match As and Bs and store them in array in ... in which case the sequence ABB becomes "clever fox jumps over clever ...
    (comp.lang.perl.misc)
  • Re: Storing a value for later use in vba or a Macro
    ... Dim strCurrentCustomer as String ... do you programmatically store a value from one record to use in ...
    (microsoft.public.access.gettingstarted)
  • Re: Storing wave files in database
    ... analyse them and store everything in some sort of database. ... You don't store the Wave files in the database. ... ByVal lpOperation As String, _ ... Dim lRet As Long, varTaskID As Variant ...
    (microsoft.public.dotnet.framework.adonet)
  • Re: Question about a data structure
    ... I'll store the ... string, it could just be a simgle 150 character string. ... , personally, I'd avoid 'stringing' together responses. ...
    (alt.php)
  • RE: adding data to a file before it gets regexed
    ... The reasion I am trying to add the string to the line, is so that I can use ... it is not a good idea to store entire files in memory and it is really ... the arrays are the contents of the files broken down by lines. ... Any opinion expressed in this e-mail is personal to the sender ...
    (perl.beginners)