Answer the question
In order to leave comments, you need to log in
How to write a regular expression for text?
Hello.
I have no experience in regular expressions, so the next question is:
there is a huge database consisting of records of a certain format ( Date | Credit-Debit | Description ). I need to pull out all these three data. And in the process of this, immediately determine what is Credit or Debit: Credit is located in the middle , debit is on the right .
Source example: pastebin.com/vL3GZqsN
Answer the question
In order to leave comments, you need to log in
/(.*)\|[\s\t]+[\s\t]+([0-9.,-]+(([\t\s]+)|))\|(.*)/gu
Well Duc and what will you parse? Your string miraculously beats on the symbol '| by three elements' at least with the same regular expression "^(.*?)\|(.*?)\|(.*?)$".
If there are no gaps in the middle element on the right, then this is a debit, if there is, a credit. You can check for the last character...
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question