Re: Simple string search



On 2 nov, 21:39, spamb...@xxxxxxxxxx (Doug Miller) wrote:
In article <1194033024.617604.170...@xxxxxxxxxxxxxxxxxxxxxxxxxxx>, jordilin <jordi...@xxxxxxxxx> wrote:

Yes, there is more than one way to do it. This is Perl, isn't it? By
the way, can you explain the following regex?
m/id="(.{12})"/
I am not sure about this 12 between brackets.

. means "any character"
{12} means "whatever came just before this, we're looking for 12 of it".

So .{12} means "any sequence of exactly 12 characters", and (.{12}) means
"open paren, followed by any sequence of exactly 12 characters, followed by
close paren".

--
Regards,
Doug Miller (alphageek at milmac dot com)

It's time to throw all their damned tea in the harbor again.

Well, I understand. The problem is that, in this example the ids
differ in length, so it does not work here. We should write sth like

m/id="(.{7,})"/

match at least 7 times, taking into account there are no ids with less
than 7 chars.
Thanks
jordi

.



Relevant Pages

  • Re: Simple string search
    ... can you explain the following regex? ... I am not sure about this 12 between brackets. ... means "any character" ... It's time to throw all their damned tea in the harbor again. ...
    (comp.lang.perl.misc)
  • Re: Processes in Linux from Python
    ... grep -v grep ... The brackets around the 'h' (which make it a character ... or range if you prefer) prevent the regex from matching itself. ...
    (comp.lang.python)
  • Re: Whar are invalid characters in a hardware or compatible id?
    ... I need to know an ASCII character that is definitely invalid in a hardware ... Our software has to send the hardware IDs and compatible ... IDs of a Windows client via a Webservice interface across the wire. ... appear in hardware IDs or compatible IDs. ...
    (microsoft.public.development.device.drivers)
  • Re: Hub transport regex is broken, a horrible implementation, or Im an idiot.
    ... grep, egrep, and perl - all of which use a standard regex ... occurrences of the preceding character. ... I don't know which regex engine they use, ... organization' predicate, I can already tell you it won't work thanks ...
    (microsoft.public.exchange.admin)
  • Re: In Find and Replace: How To Find Any Combination Of Characters
    ... When I use wildcards, Word can¹t search for certain items. ... As for RegEx, ... It helps greatly to have a very accurate and definitive "problem statement" ... matches any single character, but only ONE character in the ...
    (microsoft.public.mac.office.word)