locked
Can I extract the specified word from string ? RRS feed

  • Question

  • User552211780 posted

    Hi.

    I am receiving data from other computer over tcp/ip and the received type is below...

    "Info,Reply:Timestamp 75ff, SpecificID c07c343aInfo,Reply:Timestamp 76ff, SpecificID c07c3089"

    In the above string, i want to get only BOLD string value.

    Sometime the data would be "Info,Reply:Timestamp 75ff, SpecificID c07c343a" and

    sometimes it would be many repeated value like

    "Info,Reply:Timestamp 75ff, SpecificID c07c343aInfo,Reply:Timestamp 76ff, SpecificID c07c3089Info,Reply:Timestamp 75ff, SpecificID c07c345aInfo,Reply:Timestamp 76ff, SpecificID c07c3088..."

    Some people say I will be able to get them through regex.

    But I don't know how to make regular expression for getting this value.

    I hope somebody can help me.

    thanks

    Thursday, August 18, 2011 4:52 AM

Answers

  • User1105670391 posted

    try this:

    string pattern = "SpecificID [0-9a-z]{8}";

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Sunday, August 21, 2011 1:47 PM