Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. Visual Basic
  4. Query Parameters and Regular Expression

Query Parameters and Regular Expression

Scheduled Pinned Locked Moved Visual Basic
regexdatabaseoraclehelptutorial
3 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • D Offline
    D Offline
    Danilo Corallo
    wrote on last edited by
    #1

    Hi to all, I working to a query tool. The user can load a query and execute it. Some queries can contain "variables". I looked on Internet and I found they can have different aspect. The Microsoft provider executes with no problem, queries like:* SELECT * FROM Table WHERE ID = :variable I'm trying to execute queries like:

    • SELECT * FROM Table WHERE ID = ?
    • SELECT * FROM Table WHERE ID = &variable
    • SELECT * FROM Table WHERE ID = &<name="variable1" type="string"> They are named as follow:
    • Oracle style bindings
    • JDBC style bindings
    • Name unknown (used for example by QueryReporter)
    • Name unknown (used for example by QueryReporter) To do that I've wrote a Regular Expression for each type.
    • "[\s]*?:[\s]*?([A-Za-z0-9^\s^<^,]*)"
    • "[\s]*?([\?])[\s^,^<]*?"
    • "[\s]*?&[\s]*?([A-Za-z0-9_^\s^<^,]*)"
    • "&[\s]*?<[\s]*?[nN][aA][mM][eE][\s]*?=[\s]*?""([^""\r\n]*)?""[\s]*?([tT][yY][pP][eE][\s]*?=[\s]*?""([^""\r\n]*)?""[\s]*?)?>" My problem is this one: I want to exclude the strings contained inside "" or '' e.g. I don't want to match ":this" because it's not a variable to bind SELECT * FROM Table WHERE Column = "Hello world :this is me" Hope I've been clear Thanks in advance ;P
    J 1 Reply Last reply
    0
    • D Danilo Corallo

      Hi to all, I working to a query tool. The user can load a query and execute it. Some queries can contain "variables". I looked on Internet and I found they can have different aspect. The Microsoft provider executes with no problem, queries like:* SELECT * FROM Table WHERE ID = :variable I'm trying to execute queries like:

      • SELECT * FROM Table WHERE ID = ?
      • SELECT * FROM Table WHERE ID = &variable
      • SELECT * FROM Table WHERE ID = &<name="variable1" type="string"> They are named as follow:
      • Oracle style bindings
      • JDBC style bindings
      • Name unknown (used for example by QueryReporter)
      • Name unknown (used for example by QueryReporter) To do that I've wrote a Regular Expression for each type.
      • "[\s]*?:[\s]*?([A-Za-z0-9^\s^<^,]*)"
      • "[\s]*?([\?])[\s^,^<]*?"
      • "[\s]*?&[\s]*?([A-Za-z0-9_^\s^<^,]*)"
      • "&[\s]*?<[\s]*?[nN][aA][mM][eE][\s]*?=[\s]*?""([^""\r\n]*)?""[\s]*?([tT][yY][pP][eE][\s]*?=[\s]*?""([^""\r\n]*)?""[\s]*?)?>" My problem is this one: I want to exclude the strings contained inside "" or '' e.g. I don't want to match ":this" because it's not a variable to bind SELECT * FROM Table WHERE Column = "Hello world :this is me" Hope I've been clear Thanks in advance ;P
      J Offline
      J Offline
      J4amieC
      wrote on last edited by
      #2

      Danilo Corallo wrote:

      Hope I've been clear

      You've not been clear at all... try asking a question for starters

      D 1 Reply Last reply
      0
      • J J4amieC

        Danilo Corallo wrote:

        Hope I've been clear

        You've not been clear at all... try asking a question for starters

        D Offline
        D Offline
        Danilo Corallo
        wrote on last edited by
        #3

        I need a Regular Expression to match the bold part: SELECT * FROM Table WHERE ID = ¶meter but not this one SELECT * FROM Table WHERE ID = "Me&You" Thanks

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups