Find specific text.

This is a discussion on Find specific text. within the C Programming forums, part of the General Programming Boards category; Hi, I have the following string: <INPUT TYPE="text" SIZE=40 NAME="user" VALUE="john"> <br> i would like to extract the VALUE so ...

  1. #1
    Registered User mmarab's Avatar
    Join Date
    Jul 2007
    Posts
    30

    Find specific text.

    Hi,

    I have the following string:

    <INPUT TYPE="text" SIZE=40 NAME="user" VALUE="john"> <br>

    i would like to extract the VALUE so in this case "john", and then replace it with something else. Can regular expressions be used in C?

    Thanks
    In times of war, shoot!

  2. #2
    C++まいる!Cをこわせ! Elysia's Avatar
    Join Date
    Oct 2007
    Posts
    22,621
    Is it possible? Sure. Is it the easiest thing? No.
    Searching and finding is easy. Try strchr (I think).
    To replace "john" with something else, you may have to move data back of forth first (memmove), and then copy the appropriate string into place (strcpy).
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.

  3. #3
    Kernel hacker
    Join Date
    Jul 2007
    Location
    Farncombe, Surrey, England
    Posts
    15,677
    There are regular expression libraries that you can use in C. Search the web (e.g. sourceforge).

    --
    Mats
    Compilers can produce warnings - make the compiler programmers happy: Use them!
    Please don't PM me for help - and no, I don't do help over instant messengers.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Deleting Text from a Text file
    By Daved in forum C++ Programming
    Replies: 5
    Last Post: 11-04-2006, 08:47 PM
  2. find if text in edit box has been changed
    By willc0de4food in forum Windows Programming
    Replies: 13
    Last Post: 09-10-2005, 10:47 PM
  3. Replies: 3
    Last Post: 05-25-2005, 01:50 PM
  4. mygets
    By Dave_Sinkula in forum C Programming
    Replies: 6
    Last Post: 03-23-2003, 06:23 PM
  5. Variable question I can't find answer to
    By joelmon in forum C++ Programming
    Replies: 3
    Last Post: 02-12-2002, 03:11 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21