I want to take the first comma seperated value from that string.
"Lines.No;StartPos=3;RightAligned;MaxLength =2"
I used "\b.*\;" regex to take "Lines.No". But the result is
"Lines.No;StartPos=3;RightAligned;"
thanks.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
First, anchor the search at the start of the string. Then use a lazy quantifier:
^\b.*?;or a negated character class:^\b[^;];But careful: Could semicolons appear in your CSV fields (in quoted strings)? If so, regexes can still be made to work, but will be a lot more complicated – a CSV parser would be much better.