Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9248089
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T09:53:03+00:00 2026-06-18T09:53:03+00:00

I am creating a small library for parsing XML documentation in Javascript files in

  • 0

I am creating a small library for parsing XML documentation in Javascript files in the following format:

/// <doc type="function" name="parse">
///     <summary>Parses javascript documentation</summary>
///     <param name="js" type="string">Javascript input</param>
/// </doc>
var parse = function(js) { ... };

/// <doc type="string">
///   <summary>Holding the version of our library</summary>
/// </doc>
var VERSION = '0.0.1';

I have to create a regular expression that returns the content between the and tags. I’ve tried the following regular expression but it failed:

var xmlComments = js.match(/ \/\/\/(\s)<doc(.*)>(.*)<\/doc>/gi /);

But the match did not work, I hope someone can help me with this regular expression, thanks.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-18T09:53:04+00:00Added an answer on June 18, 2026 at 9:53 am

    If you are trying to get the content between the opening and closing doc tags, you could use

    /<doc[^>]*>([\s\S]+?)<\/doc>/gi
    

    where [\s\S] is any character including newlines ( . will not match newlines ).

    For example

    var xmlComments = [],
        regex = /<doc[^>]*>([\s\S]+?)<\/doc>/gi,
        match = regex.exec( js );
    
    while ( match != null ) {
        xmlComments.push( match[1] );
        match = regex.exec( js );
    }
    

    where js is the file as a string.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm creating a small canvas library in which I have an anonymous function which
I have small library i want to use for creating games. First, i tried
At the moment I am working on creating a small library for common data
I'm having a bit of trouble with a small Javascript library that I am
I wrote a small makefile which follows the general structure, creating object files and
by using flash cs5 with a huge internal image library (over 300+ small png-files)
I'm creating small form for iPhone and on that form I do JavaScript validation
I am creating a small C++ wrapper shared library around a Fortran 95 library.
I'm experimenting with creating a small library/DSL for image synthesis in Clojure. Basically the
I'm wondering about the merits of creating a small library, probably for personal use

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.