On Sep 18, 1:26 pm, Peter Bailey <pbai... / bna.com> wrote: > > If this still won't work on your file, could the file > > be contaminated with some non-displaying characters > > that appear to be whitespace but aren't? > > Perhaps this would be worth a try: > > /<issueList>[^<>]*<issue\W+code="[A-Z]{3}">(.*?)<\/issue>/m > > Still no go, William. I tried your last phrase there, too. You've got to track down what's going on. Copy and paste the code below into a file. (Don't even think about typing it in.) Run the file. Is this the output? "\nI'm Issue XIV,\nwho are you?\n" "\nI'm Issue XX, are you?\n" "Trade (Domestic & Foreign)" If it is, open both the Ruby file and the xml file with the same editor; copy the first desired entry from the xml file and paste it at the bottom of the big string in the Ruby file. Even though it looks like an exact duplicate of what's already in the string, maybe it differs somehow. The output should now be: "\nI'm Issue XIV,\nwho are you?\n" "\nI'm Issue XX, are you?\n" "Trade (Domestic & Foreign)" "Trade (Domestic & Foreign)" If it isn't, edit the entry that you just pasted into the big Ruby string; delete spaces and line-endings and replace them with new spaces and line-endings. (Perhaps the the xml file has some bizarre invisible characters.) %q{ <issueList> <issue code = "BCD" > I'm Issue XIV, who are you? </issue> <issueList><issue code="XYZ"> I'm Issue XX, are you? </issue> <issueList> <issue code="TRD">Trade (Domestic & Foreign)</issue> </issueList> }.scan( # Using extended-mode regular expression for clarity. # Whitespace and comments are ignored. %r{ <issuelist> \s* <issue[ \t]+code[ \t]*=[ \t]*"[^"]*"[ \t]*> (.*?) </issue> }xmi ){ p $1 }