Results 1 to 2 of 2

Thread: Is this possible using Regex or any other way?

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Apr 2010
    Location
    York, Uk
    Posts
    103

    Is this possible using Regex or any other way?

    Hi Chaps,

    Would appreciate any assistance here as i'm "busting my nut" trying to figure this out.

    I have to read a value from a SQL script which usually starts like so

    [
    Code:
    /*****************************************************************/
    DECLARE @ApplicationID VARCHAR(50), @TaskID INTEGER, @Description VARCHAR(255)
    SET @ApplicationID = 'SYSTEM' SET @TaskID = 69453 SET @Description = 'Bla BLA'

    I need to scan the file using the fastest possible way and get the TaskID, I have found one way to do it being

    find index of @TaskID = then increment the index by 9 "TaskID =" then remove every thing preceding it
    finally remove everything after 5 chars in, so I end up with string Task ='69453'

    This is wildly inefficient as I have to loop this for several hundred directories.


    There must be an easier way??

  2. #2
    Hyperactive Member Cyb3rH4Xter's Avatar
    Join Date
    May 2009
    Location
    Sweden
    Posts
    449

    Re: Is this possible using Regex or any other way?

    I am not a pro at regex or linQ but this is the Regex I would use:

    "@TaskID = \d{5} " But it only works if the ID always is 5 numbers. And you would still have to strip down the matches. Sorry but I don't have a better solution.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width