.net - Regex: Match character but exclude from pattern -


I have a barcode which I am trying to parse in my document imaging software, through the regular expression of the underlying I believe .net These loan documents have barcodes, which include an account number and sub-account number delimited by a dash (-). The most difficult part of it is that the sub-account number decreases, the account number is that which is full of zero for compensation. Some examples of showing account / sub-account numbers begin at position 11 below and go for 15 characters (including dashes). I need two different regex patterns (one for matching the account number before the dash and one after the other). In all instances, the first 10 zeros is not actually being used in another field. So before matching everything - will work in the short term but if they decide to start using that area, then this will not work. I need some way to parse it, which will give me a 11-25 split position on the dash. I can include a sub account number on the account number and a dash at zero because I have the option of "remove all the main methods of __ character" within the software. I will assign a leading dash to the leading zero and sub account in the account automatically Can we get out of

0000000000123456789-12345133304302014

account = 123456789 sub = 12345

00000000000123456789- 1234133304302014

account = 0123456789 sub = 1234

000000000000123456789-123133304302014

account = 00123456789 sub = 123

0000000000000123456789-12133304302014

account = 000123456789 sub = 12

00000000000000123456789 -1133304302014

account = 0000123456789 sub = 1

edit:

The last working regex syntax is as follows: < / p>

Account number = [1-9]. (? =. -)

Sub-account number = (? & lt; = -). (? = (............ $)) *

  \ d {10} (\ d +) - (\ d +) \ d {12}   

If you are leading in your groups in the future Also, indexed fields need to be acquired:

  (\ d {10}) (\ d +) - (\ d +) (\ d {12})   

If you want you can remove zero padding on the account number by matching zero or more leading zeros:

  (\ d {10}) 0 * ( \ d +) - (\ d +) (\ d {12})   

(These solutions are the length of the first and last fields.) < / Html>

Comments

Popular posts from this blog

Verilog Error: output or inout port "Q" must be connected to a structural net expression -

jasper reports - How to center align barcode using jasperreports and barcode4j -

c# - ASP.NET MVC - Attaching an entity of type 'MODELNAME' failed because another entity of the same type already has the same primary key value -