Got more questions? Find advice on: ASP | SQL | XML | Windows
Welcome to RegexAdvice Sign in | Join | Help

Re: Reading specific values from string:

  •  08-10-2008, 6:32 PM

    Re: Reading specific values from string:

    Thank you for your assistance !

    More specific goal is find VALUE knowing a KEY from STRING.

    sampleString =  "source_string_to_KEY1:VALUE1_match_with_pattern_KEY2:VALUE2"

    So for example I need to capture (only) VALUE1 when i know only KEY1 from that sampleString.

    Key:Value pairs are with colon-separated form. All words are underline-separated in that string. String is used in DOM Element ID name.

    Yes, I can solve this with unskilful string handling. Like splitting string by '_' to substrings, finding stings, that contains ':', then comparing first part of this substring with knowing key and finally return last part as a match.

    Probably there is possibility find this match simply with regular expression. This regex should find this key:value pair but only capture required value part. Is there any possibility ?

    This is my goal.
     

View Complete Thread