K
Keith G Hicks
I'm writing some vb.net code to create a CLR for my SQL app. I've got most
of it running fine but the regular expression I'm using to locate a dollar
value in a TEXT column is not working right.
Here is the expression I'm using:
\(\$((\d{1,3})(\,\d{3})*)|(\d+)(\.\d{2})?\)
I need it to locate anything like the followiing:
($61245788)
($944848.23)
($1,984,545)
($5,654.23)
But I need it to reject anything that is NOT in parentheses, does not have a
dollar symbol in front, has more than 2 digits to the left of the decimal,
and if it has commas, all the numbers must of course be in groups of 3's.
The parentheses in the value to be found are not there to indicate negative
values. The amount is simply in parentheses for readability.
I'm having a heck of a time getting the regex to work right. It's rejecting
values I think it should pick up and sometimes only getting part of the
value. I'm not very good with these yet. Any help would be greatly
appreciated.
Thanks,
Keith
of it running fine but the regular expression I'm using to locate a dollar
value in a TEXT column is not working right.
Here is the expression I'm using:
\(\$((\d{1,3})(\,\d{3})*)|(\d+)(\.\d{2})?\)
I need it to locate anything like the followiing:
($61245788)
($944848.23)
($1,984,545)
($5,654.23)
But I need it to reject anything that is NOT in parentheses, does not have a
dollar symbol in front, has more than 2 digits to the left of the decimal,
and if it has commas, all the numbers must of course be in groups of 3's.
The parentheses in the value to be found are not there to indicate negative
values. The amount is simply in parentheses for readability.
I'm having a heck of a time getting the regex to work right. It's rejecting
values I think it should pick up and sometimes only getting part of the
value. I'm not very good with these yet. Any help would be greatly
appreciated.
Thanks,
Keith