Convert String to Regular Expression


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 2 of 2

Thread: Convert String to Regular Expression

  1. #1
    Join Date
    Nov 2005
    Posts
    3

    Question Convert String to Regular Expression

    Hi, anyone knows if there is a way to convert an input string into a Regular Expression??

    As a example, if I input the string: "email@mail.com" the output string should be like: "[A-Za-z]+@[A-Za-z]+\\.com"

    Thanks in advance!!

  2. #2
    Join Date
    Aug 2003
    Posts
    313
    In the most general sense, I would think that this problem is impossible. There are a lot of different regular expressions that match "email@mail.com":
    "[A-Za-z]+@[A-Za-z]+\\.com"
    "email@mail\\.com"
    "*.@mail\\.com"
    ...
    So, you are probably going to need more information than just a single String, but even with multiple strings, what if you get two strings, I still don't think you have enough information.
    ~evlich

Similar Threads

  1. Input string was not in a correct format
    By mdengler in forum ASP.NET
    Replies: 0
    Last Post: 11-26-2002, 02:32 PM
  2. Replies: 1
    Last Post: 06-05-2001, 06:12 AM
  3. Please help me -- urgent -- deadlock error
    By chandra in forum VB Classic
    Replies: 0
    Last Post: 06-22-2000, 07:36 AM
  4. Replies: 0
    Last Post: 06-22-2000, 07:30 AM
  5. Database problems
    By Robert Rieth in forum VB Classic
    Replies: 1
    Last Post: 04-11-2000, 03:21 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center