can a regex pattern match return the starting position of the match?
given how smart perl is, I was thinking there must be a function within perl whereby if one does a pattern match against a scaler, that in addition to having regex being able to return such built in vars as: $` (what preceeds the match), $' (what follows the match), $1, etc. is there a built in var that returns the position within the scalar where the match occurred? of course, if not, one may always evaluate length($`). I was just curious ___ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
Re: can a regex pattern match return the starting position of the match?
Greg- This question was answered on Stack Overflow: http://stackoverflow.com/questions/87380/how-can-i-find-the-location-of-a-regex-match-in-perl http://stackoverflow.com/questions/87380/how-can-i-find-the-location-of-a-regex-match-in-perlbrian d foy's answer seems to be the best: The built-in variables @- and @+ hold the start and end positions, respectively, of the last successful match. $-[0] and $+[0] correspond to entire pattern, while $-[N] and $+[N] correspond to the $N ($1, $2, etc.) submatches. -Conor On Thu, Apr 14, 2011 at 10:38 AM, Greg Aiken gai...@visioninfosoft.comwrote: given how smart perl is, I was thinking there must be a function within perl whereby if one does a pattern match against a scaler, that in addition to having regex being able to return such built in vars as: $` (what preceeds the match), $’ (what follows the match), $1, etc… is there a built in var that returns the position within the scalar where the match occurred? of course, if not, one may always evaluate length($`). I was just curious ___ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs ___ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
Re: Parsing a PDF with empty fields
(Apologies to the OP for first sending this to him and not the group.) On Wed, 13 Apr 2011 19:16:25 -0400, in perl you wrote: Disclaimer: I'm using Acrobat 10 and Office 2010, so YMMV. I opened the PDF in Acrobat and selected File, Save As, then chose Tables in Excel Spreadsheet (*.xml). I opened the resulting xml in Excel, and the data was properly lined up in columns. There were only 50 entries per sheet (one PDF page per sheet), but there were only 5 sheets, and the fifth sheet had the last page of the PDF. So it was missing most of the data from the PDF. I'm using Foxit, which doesn't have the options you describe. What it does have is something I found incredibly irritating: a function called Text Viewer. Select this function, and the document appears as fixed-width plain text, which is exactly a format I could use: I'd just have to count the number of characters in what would be each column, and create the array that way. However, the Text Viewer function *doesn't allow you to copy text*. (At least, not with the freeware version.) And it's claimed that PDF stands for Portable document format. At every turn I find PDFs to be less portable than plain text. -- Ted S. fedya at hughes dot net Now blogging at http://justacineast.blogspot.com ___ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs