locked
RegExp - VB.Net - pattern for not including all numerics but include alphanumeric RRS feed

  • Question

  • Hello

    I have below regexp that will match names but also match numbers

    ((^[A-Za-z0-9]+)?,([A-Za-z0-9]+)+$)

    Test,Client

    100,000

    John,Smith

    23,009

    I would like to modify above regexp to only match

    Test,Client

    John,Smith

    and exclue numerics like 100,000 or 12,990 on a line

    how do i write regexp for above to exclude all numerics but include alphanumerics

    Thanks

    Monday, May 23, 2011 1:56 PM

Answers

  • Something like ^([A-Za-z]+(,[A-Za-z]+)?|[0-9]+)$

    Just split your requirements into two separate alternations in a (..|..)

    • Proposed as answer by Jesse HouwingMVP Monday, May 23, 2011 10:06 PM
    • Marked as answer by Paul Zhou Wednesday, June 1, 2011 6:01 AM
    Monday, May 23, 2011 9:31 PM
  •  

    Hi Harris,

     

    Has your issue been resolved? Would you mind letting us know the result of the suggestions?

     

    Now I will mark an answer, you can mark others that you think to be so useful to your issue.

    You could “Unmark As Answer” if it doesn’t make sense.

     

    Have a nice day!


    Paul Zhou [MSFT]
    MSDN Community Support | Feedback to us
    Get or Request Code Sample from Microsoft
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    • Marked as answer by Harris001 Thursday, June 2, 2011 4:25 AM
    Wednesday, June 1, 2011 6:01 AM

All replies

  • Something like ^([A-Za-z]+(,[A-Za-z]+)?|[0-9]+)$

    Just split your requirements into two separate alternations in a (..|..)

    • Proposed as answer by Jesse HouwingMVP Monday, May 23, 2011 10:06 PM
    • Marked as answer by Paul Zhou Wednesday, June 1, 2011 6:01 AM
    Monday, May 23, 2011 9:31 PM
  •  

    Hi Harris,

     

    Has your issue been resolved? Would you mind letting us know the result of the suggestions?

     

    Now I will mark an answer, you can mark others that you think to be so useful to your issue.

    You could “Unmark As Answer” if it doesn’t make sense.

     

    Have a nice day!


    Paul Zhou [MSFT]
    MSDN Community Support | Feedback to us
    Get or Request Code Sample from Microsoft
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    • Marked as answer by Harris001 Thursday, June 2, 2011 4:25 AM
    Wednesday, June 1, 2011 6:01 AM