You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 4-6.RSVP
Socket
Book a DemoInstallSign in
Socket

xml-char-classes

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

xml-char-classes

Regular expressions for matching against the XML Character Classes

3.0.0
latest
Source
npmnpm
Version published
Weekly downloads
167K
-33.06%
Maintainers
1
Weekly downloads
 
Created

What is xml-char-classes?

The xml-char-classes npm package provides regular expressions for matching XML character classes. It helps in validating and working with XML data by ensuring that characters conform to XML specifications.

What are xml-char-classes's main functionalities?

Match XML Name Start Characters

This feature provides a regular expression to match valid XML name start characters. XML names must start with a letter or underscore, and this regex helps ensure that.

const xmlCharClasses = require('xml-char-classes');
const regex = new RegExp(`^[${xmlCharClasses.nameStartChar.source}]`);
console.log(regex.test('A')); // true
console.log(regex.test('1')); // false

Match XML Name Characters

This feature provides a regular expression to match valid XML name characters. XML names can include letters, digits, hyphens, underscores, and periods, and this regex helps ensure that.

const xmlCharClasses = require('xml-char-classes');
const regex = new RegExp(`^[${xmlCharClasses.nameChar.source}]+$`);
console.log(regex.test('A1-._')); // true
console.log(regex.test('A1-._ ')); // false

Match XML Char

This feature provides a regular expression to match valid XML characters. It ensures that the characters conform to the XML specification for valid characters.

const xmlCharClasses = require('xml-char-classes');
const regex = new RegExp(`^[${xmlCharClasses.char.source}]+$`);
console.log(regex.test('A1-._ ')); // true
console.log(regex.test('\u0000')); // false

Other packages similar to xml-char-classes

Keywords

xml

FAQs

Package last updated on 09 Aug 2021

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts