Hi, I have an interesting regex puzzle I hope you might be able to help me with.
What I want to do is assign a 'score' to various strings, based on their prefix. So if a file starts with 'UKL' or 'USL', it receives a score of 10; if it starts with 'EUK' or 'EUS' it receives a score of 9, if...
I have a rough HTML file (from Word 98) that I'm trying to convert into XML. I've split it into lines on </P> tags, then I'm taking each line in turn, stripping off the tags at the start, then setting a variable $italic if a <I> or </I> tag is found, so:
foreach $line (@lines) {
$line =~...
Hi, I've been searching CPAN for a while now, but I can't find an easy way to convert a Unicode entity (eg л) to UTF-8. Any advice will be very gratefully received. Thanks!
Hi, I'm trying to add an id number to each cell in a bunch of HTML tables, so I'm using the code:
while ($tabdat =~ s/<td /<td id="$idnum" /g) {
$idnum++;
}
This just hangs in a loop, so how do I do this? Apologies if this is really simple, it's Friday afternoon and I've had quite a day...
Hi, I can't find a function that will return the position of a string within an array. For example, if the array is:
[aardvark, abacus, abandon, abate, abattoir...]
I want to search it for 'abate' and return position 3. What I want to do is search an alphabetically-sorted list and see which...
Hi, I'm having trouble with this code:
while ($data =~ s/<tag>/<tag id="$id">/g) {
$id++;
}
the problem is that the updated $id doesn't get substituted in the loop, although the variable does get updated. I thought that so long as you don't use the o qualifier, the regex will recompile...
Hi, I'm hoping someone out there can save me the bother of searching through the manuals. Is there any way of telling Perl not to treat reserved characters (+, * etc) as special when they occur in interpolateed variables? For example, I had an array of various codes, some of which began with a...
Hi, I've been having trouble extracting elements from XML-ish files using regular expressions. Say I want to extract all <dat1> elements from the following data:
<thing><dat1>This</dat1><dat2>is</dat2><dat1>a</dat1><dat3>bad</dat3><dat1>format</dat1></thing>
I use the code:
while ($thing =~...
Hi, I'm hoping someone can tell me why this statement isn't working:
SELECT TOP 1 * FROM [table name]
The error I get is:
Microsoft OLE DB Provider for ODBC Drivers error '80040e14'
[Microsoft][ODBC SQL Server Driver][SQL Server]Line 1: Incorrect syntax near '1'.
If I check the syntax, it...
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.