Results 1 to 4 of 4

Thread: Regexp

  1. #1

    Thread Starter
    Member
    Join Date
    Oct 2004
    Posts
    50

    Regexp

    Hi,

    I am trying to find all my comments in the project by using regular expressions.

    Can you tell me please how can I find what's :
    - between /* ... */ (in multiples lines)
    - after //... (in the same line)

    Thanks

  2. #2
    Arabic Poster ComputerJy's Avatar
    Join Date
    Nov 2005
    Location
    Happily misplaced
    Posts
    2,513

    Re: Regexp

    1-
    Code:
    String.Substring(String,String.IndexOf("/*"),String.IndexOf("*/"));
    2-
    Code:
    String.Substring(String,String.IndexOf("//"),String.IndexOf("\n"));
    "I'm not normally a praying man, but if you're up there, save me... Superman!" - Homer Simpson
    My Blog

  3. #3
    I'm about to be a PowerPoster!
    Join Date
    Jan 2005
    Location
    Everywhere
    Posts
    13,647

    Re: Regexp

    Can you tell me please how can I find what's :
    - between /* ... */ (in multiples lines)
    - after //... (in the same line)
    Try:
    1. #/\*(.*)\*/#s
    2. ^//(.*)$

  4. #4
    I'm about to be a PowerPoster! mendhak's Avatar
    Join Date
    Feb 2002
    Location
    Ulaan Baator GooGoo: Frog
    Posts
    38,170

    Re: Regexp

    If you want to capture the comments:

    \/\*(?<longcomment>(.|\s)+)\*/
    \/\/(?<shortcomment>(.*))

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