简体   繁体   中英

Regular Expression to exclude CRLF from a line in string

I have this regular expression that would extract data and put into three different group: begin, CustomerNo and end.

^(?<begin>(.*?[|]){14})(?<CustomerNo>.*?)(?<end>[|].*)*$

This is working, except that the "end" group would contain CrLf character at the end. Is there a way to not to include CrLf character at the end of each line with the regular expression above?

尝试这个:

@"^(?<begin>(.*?[|]){14})(?<CustomerNo>.*?)(?<end>[|][^\r\n]*)"

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM