regex

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

    regex

    hi!
    can anyone help me with solving my problem?
    i want to check my string if there's such substring in it:
    <div class="some_cla ss_i_want_to_se t_this_value_be fore_checking">
    text_to_retriev e </div>

    i would like to get in return text_to_retriev e. i know i have touse regular
    expressions, a well known of working example for html tags is
    @<(?<tag>\w*)>( ?<text>.*)</\k<tag>> , but it will return only things like:
    <p>ajajajaja</p>
    how to solve my problem?
    please help...


  • Dan

    #2
    Re: regex

    You may try with something like:

    <div\s+class="d ummy"[^>]*>\s*([^<]*)\s*</div>

    and get the group 1 from the resulting match (e.g. myMatch.Groups[1].Value).


    Comment

    • Skur

      #3
      Re: regex

      > You may try with something like:[color=blue]
      >
      > <div\s+class="d ummy"[^>]*>\s*([^<]*)\s*</div>
      >
      > and get the group 1 from the resulting match (e.g.
      > myMatch.Groups[1].Value).[/color]
      NICE!!
      and now... do You know how to solve in an easy way problem of searching a
      text looking for multiply patterns?
      e.g. i have like 10 possible patterns to look after and would like in each
      every step of .GetNextMatch search for all of them , not just one....


      Comment

      Working...