Re: Regex help



I had a similar experience and the following modified block helped


Dim regexp As Regex = New Regex("<div id=((.|\n)*?)config</div>",
RegexOptions.IgnoreCase)

Dim str As String
Dim objMatch As Match
For Each objMatch In regexp.Matches(text)
str = objMatch.ToString()
Next

Hope this helps

Michael


"Marius Trælnes" <marius.traelnesnospam@xxxxxxxxxxxxx> wrote in message
news:eCLstPcbFHA.1040@xxxxxxxxxxxxxxxxxxxxxxx
> Hello!
>
> I have a file with following htmlt tags:
>
> ....can be anything before....
> <div id="SomeConfig">
> some text, can be anything here, also any tag
> </div>
> ....can be anything after......
>
> I want to "cut" out the div which has an id attribute with config in its's
> value. In the above sample
> this would be:
> <div id="SomeConfig">
> some text, can be anything here, also any tag
> </div>
>
> I try with this but it does not work:
>
> Dim re As Regex = New Regex("(<div id=.*?config.*?div>)",
> RegexOptions.IgnoreCase)
> Dim m As Match = re.Match(Text)
> Dim s As String = m.Value()
>
> Any suggestions?
>
> Marius
>
>


.



Relevant Pages

  • Regex help
    ... I have a file with following htmlt tags: ... some text, can be anything here, also any tag ... I want to "cut" out the div which has an id attribute with config in its's ... Dim m As Match = re.Match ...
    (microsoft.public.dotnet.languages.vb)
  • Re: Regex help
    ... > I have a file with following htmlt tags: ... > some text, can be anything here, also any tag ... > Dim m As Match = re.Match ... Prev by Date: ...
    (microsoft.public.dotnet.languages.vb)
  • Re: Additional TreeView Property?
    ... information including what you are currently putting in the tag and use the ... Dim iFile As Integer ... Dim FileName As String ...
    (microsoft.public.vb.general.discussion)
  • Re: VBA: Selectively Deleting Notes in a PowerPoint PPT
    ... tag that with a PPT tag. ... Dim oSl As Slide ... Dim oSh as Shape ... For Each oSl In ActivePresentation.Slides ...
    (microsoft.public.powerpoint)
  • Re: shorts and longs
    ... aren't all TIFF IFD entries and tag values stored as unsigned values? ... so, when i Dim m_Compression as Integer and the return value is 32773, i get ... > as a long which is what you store in your application. ... > Dim TempWord As Integer ...
    (microsoft.public.vb.general.discussion)