verris Posted February 16, 2009 Share Posted February 16, 2009 Thanks all for your help. It turned out the file to analyze was even more in disarray than I thought, even the fields were not always in the same order, so I produced a solution with many more lines of code that first chops the data into usable chunks and then pushes the data snippets individually into different variables. It works, thanks a lot for getting me on the right train folks! Link to comment Share on other sites More sharing options...
ynbIpb Posted May 30, 2009 Share Posted May 30, 2009 Hi. I need to extract from the text of two fragments that are in quotation marks. For example: bla-bla, "first fragment", and again, bla bla, "second fragment", and other text ...result should be: first fragment and second fragmentThis can be realized using StringRegExpReplace?I got only so, but it is a lot of code.$orig_string = 'bla-bla, "first fragment", and again, bla bla, "second fragment", and other text ...'$string_len = StringLen ($orig_string)$1st_pos = StringInStr ( $orig_string, '"' , 0 , 1)$2st_pos = StringInStr ( $orig_string, '"' , 0 , 2)$3st_pos = StringInStr ( $orig_string, '"' , 0 , 3)$4st_pos = StringInStr ( $orig_string, '"' , 0 , 4)$1st_string = StringTrimLeft( $orig_string, $1st_pos)$Right_trim = $string_len - $2st_pos + 1$1st_string = StringTrimRight( $1st_string, $Right_trim)$2st_string = StringTrimLeft( $orig_string, $3st_pos)$Right_trim = $string_len - $4st_pos + 1$2st_string = StringTrimRight( $2st_string, $Right_trim)MsgBox(0,"extract from the text..","Original: "&$orig_string&@CRLF&@CRLF&"1st: "& _$1st_string&@CRLF&"2st: "&$2st_string) Link to comment Share on other sites More sharing options...
ynbIpb Posted May 31, 2009 Share Posted May 31, 2009 (edited) Thank you, but the result should be without quotes.Me showed another solution: $arrayOFparametrs=StringRegExp($sTekst, '(?:"(.*?)")+?', 3)The problem is solved, thanks for the help. Edited May 31, 2009 by ynbIpb Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now