regex to exctract informations

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Bob

    #1

    regex to exctract informations

    Dears,

    I am trying to search and replace strings with regex.

    The string is identified by a keyword :

    IDImage("1M2345 67");
    DescriptionImag e("Desc of the Image 1");

    I want to exctract the IDImage (1M234567 ) and the Description.

    The ID are characters and numbers, the description too.

    Thx,

    Bertrand
  • Colin Gillespie

    #2
    Re: regex to exctract informations

    Bob wrote:[color=blue]
    > Dears,
    >
    > I am trying to search and replace strings with regex.
    >
    > The string is identified by a keyword :
    >
    > IDImage("1M2345 67");
    > DescriptionImag e("Desc of the Image 1");
    >
    > I want to exctract the IDImage (1M234567 ) and the Description.
    >
    > The ID are characters and numbers, the description too.
    >
    > Thx,
    >
    > Bertrand[/color]
    If the string is always in IDImage("#####" );

    Then what about

    x='IDImage("### ##");'
    print x[9:-3]

    Likewise for the Description.

    HTH

    Colin

    Comment

    Working...