Regex : To exclude white spaces in a line which is between 2 numbers (.net) -
i have statement (in line) , want extract numbers , not dots , blank spaces. of great help if can help me out. below illustration statement (single line string):
bic: xxxxxxxx naam: mr. yyyyy inz. abcirr. ne abcdefghijlk: abcde: 57.10.70.13 2 nexprk bv if te verrekenen saldo
output require : 571070132
what have achieved pull in digits lone (without 2), below regex : (\d{2}.\d{2}.\d{2}.\d{2}) unable go ahead this. please help
you not need regex - linq look str.where(char.isdigit) work better:
var str = "bic: xxxxxxxx naam: mr. yyyyy inz. abcirr. ne abcdefghijlk: abcde: 57.10.70.13 2 nexprk bv if te verrekenen saldo"; var res = new string(str.where(char.isdigit).toarray()); console.writeline("'{0}'", res); this produces next output:
'571070132' the problem applying regex match produced in multiple groups, code need iterate them in order build final output. linq provides more direct approach easier read.
.net
No comments:
Post a Comment