Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Search results for query: *

  • Users: domster
  • Content: Threads
  • Order by date
  1. domster

    Regex to assign score?

    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...
  2. domster

    $1 not set by regexp in loop

    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 =~...
  3. domster

    Unicode entity conversion

    Hi, I've been searching CPAN for a while now, but I can't find an easy way to convert a Unicode entity (eg &#x043B;) to UTF-8. Any advice will be very gratefully received. Thanks!
  4. domster

    Updating a variable within a s///g

    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...
  5. domster

    Position of string within array?

    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...
  6. domster

    Interpolating variables in a loop

    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...
  7. domster

    regex special chars in interpolated variables

    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...
  8. domster

    reg.exp. *? bug?

    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 =~...
  9. domster

    SELECT TOP error

    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...

Part and Inventory Search

Back
Top