![]() |
![]() |
We are currently migrating this forum over to our HelpSystems domain. Please post all new threads in our new HelpSystems Community Portal. |
![]() |
|
![]() |
AutoMate Discussion | ![]() |
help :
faq :
home
|
||
Latest News:
|
latest topics : statistics |
Topic Title: regex Help Topic Summary: Regex Created On: 10/24/2012 03:52 PM Status: Read Only |
Linear : Threading : Single : Branch |
![]() |
![]()
|
![]() |
|
is there anybody who can help with the following problem at all, i have tried reading books and exploring websites but cannot figure out who to create this regex based on the parameters i have to work with
we recieve txt files with a large volume of content that is seperated by tags. DP - 2009 TI - Serum and synovial fluid concentrations of CCL2 (MCP-1) chemokine in patients suffering rheumatoid arthritis and osteoarthritis reflect disease activity. PG - 641-6 This is just an example, but what im trying to is extract all from the TI tag across both lines the tags before and after vary, so we cannot use this as point in the regex, so my first thought was apply the regex to capture all from TI - until the next point that contained another tag folowed by -, but as you can see their is a MCP-1 in the field i want and the regex stops short is there a way to create a regex where it see's the start of a line, for instance our regex would start from TI - then take all on that line and if next did not start with XX - then it would take that line also until it met a new line starting with XX - The regex has to start from TI and take all until it meets a new line that starts with an opening tag this is the regex i have created, but as mentioned it fails as it thinks a tag is present in the line TI Tag - TI\s\s\-\s(.|\n)*?(?=[A-Z]{2,4}\s{0,3}\-\s{0,3}) any help on this would be greatly appreciated, it is driving me mad ![]() many thanks in advance grant |
|
|
|
![]() |
|
Based on your example, something like the following should work:
Loop through all of the records, assigning the current text to a variable. Using an InStr and Left statement (or Mid) to determine if there is an "-" in the first 4 fields. If one is present, then add it to the output prefixed by a new line (I.E. varOutputRecord = varOutputRecord & vbCrLf & varCurrentRecord). If one is not present, then add it to the output without a new line, which should append it to the existing record (I.E. varOutputRecord = varOutputRecord & " " & varCurrentRecord) To eliminate any errors, it would be best if you knew what all the tags are and accounted for them, in the event that the second line actually contains text that meets the criteria above. ------------------------- ?? . Your Total IT Solutions Provider ?? . Business Class Hosting Services |
|
|
AutoMate Discussion
» GENERAL » General Discussion
»
regex Help
|
![]() |
FuseTalk Enterprise Edition v4.0 - © 1999-2021 FuseTalk Inc. All rights reserved.