jovball
asked on
Use regEx to get substrings
I am trying to extract certain values from a long text file (actually postscript). It is mostly unstructured so I need a flexible parsing method. I think I'm looking for the RegEx counterpart to a SQL Like valuestartswith%valueendsw ith (or valuestartswith*valueendsw ith). That is, I know what the match should start with and I know what it ends with but I don't know what's in between.
I put some sample data below. The initial goal is just to retrieve the text between the "/Type" and "end" for each block of data. Alternatively, it would be fine to strip out the other text. It would be even better if I could extract an array containing Type,Q,D,A for each block.
My preferred language would be .Net but I'm not closed to other options.
Here is some sample data
/Type Text
/Q (dept)
/D (sales)
/A (1)
end
/random text
/more random text
/still more random text
/Type Date
/Q (birthdate)
/A (Jan-1-1968)
end
/other stuff
/more other stuff
/Type Text
/Q (title)
/A (Asst. Marketing VP)
end
I put some sample data below. The initial goal is just to retrieve the text between the "/Type" and "end" for each block of data. Alternatively, it would be fine to strip out the other text. It would be even better if I could extract an array containing Type,Q,D,A for each block.
My preferred language would be .Net but I'm not closed to other options.
Here is some sample data
/Type Text
/Q (dept)
/D (sales)
/A (1)
end
/random text
/more random text
/still more random text
/Type Date
/Q (birthdate)
/A (Jan-1-1968)
end
/other stuff
/more other stuff
/Type Text
/Q (title)
/A (Asst. Marketing VP)
end
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
jovball, do you need any additional help or can this question be closed ?
This question has been classified abandoned. I will make a recommendation to the
moderators on its resolution in a week or two. I appreciate any comments
that would help me to make a recommendation.
<note>
Unless it is clear to me that the question has been answered I will recommend delete. It is possible that a Grade less than A will be given if no expert makes a case for an A grade. It is assumed that any participant not responding to this request is no longer interested in its final disposition.
</note>
If the user does not know how to close the question, the options are here:
https://www.experts-exchange.com/help/closing.jsp
Cd&
moderators on its resolution in a week or two. I appreciate any comments
that would help me to make a recommendation.
<note>
Unless it is clear to me that the question has been answered I will recommend delete. It is possible that a Grade less than A will be given if no expert makes a case for an A grade. It is assumed that any participant not responding to this request is no longer interested in its final disposition.
</note>
If the user does not know how to close the question, the options are here:
https://www.experts-exchange.com/help/closing.jsp
Cd&
No comment has been added lately, so it's time to clean up this TA.
I will leave a recommendation in the Cleanup topic area that this question is:
Split between avner and markhoy
Please leave any comments here within the next seven days.
PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!
Programming_Gal
EE Cleanup Volunteer
I will leave a recommendation in the Cleanup topic area that this question is:
Split between avner and markhoy
Please leave any comments here within the next seven days.
PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!
Programming_Gal
EE Cleanup Volunteer