Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
PerlMonks  

Re: Using a regexp to extract sequence fields

by MCS (Monk)
on Feb 13, 2006 at 15:02 UTC ( [id://529842]=note: print w/replies, xml ) Need Help??


in reply to Using a regexp to extract sequence fields

The problem (well not really a problem but given your example, a problem) with Regular Expressions is that they are very specific. In order for us to help you more, we need a little more information

Are you just trying to match a specific line of text? (ie 'blabla2') or are you trying to match blabla[some number]? If you are looking for an exact string, your best bet is to use split (as per other examples here) and then iterate over the array (say a foreach) and compare each item to your string.

Of course you say that 'anything' or 'blabla' are arbitrary sequences, I'm guessing you're not trying to match an exact string but rather a positional thing. In that case, use split and then you will have your data in an array and you can go to any position. $yourarray[2] for 'blabla2' $yourarray[0] for 'blabla1' etc...

If you are looking for 'blabla#' where # is a number you can use the regex: $mystring =~ /blabla\d+/. If you need more information than I've provided, you're going to have to provide more information about your requirements.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://529842]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others musing on the Monastery: (2)
As of 2024-04-20 11:59 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found