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.


In reply to Re: Using a regexp to extract sequence fields by MCS
in thread Using a regexp to extract sequence fields by tamaguchi

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.