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 5931517
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T14:42:21+00:00 2026-05-22T14:42:21+00:00

From the node REPL thing, > ‘function’.search(‘io\.’) 5 I really need it to match

  • 0

From the node REPL thing,

> 'function'.search('io\.')
5

I really need it to match only “io.” and not “function” or anything with just “io” in the middle…

More weird things:

> 'io'.search('io\.')
-1
> 'ion'.search('io\.')
0

So it appears I’m not escaping the dot character..? But I am with the “\”… right ? I tested it on both http://www.regextester.com/ and http://regexpal.com/ and it works the way I think it’s supposed to work.

What am I doing wrong ? Is the regex stuff in node.js somewhat different then what I’m used to ?

EDIT1: In Google Chrome’s javascript console I get also

'function'.search('io\.')
5

So it might be a v8 thing… right ?

EDIT2: I get the same results from Firefox’s javascript console, so it’s not a v8 thing… What’s happening here ? I’m really confused…

  • 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-05-22T14:42:22+00:00Added an answer on May 22, 2026 at 2:42 pm

    Your regex is right, but you have to encode it for putting it in a string, too.
    So, your (correct) regex looks like this:

    io\.
    

    However, The backslash is also a string escape character. In order to create a string containing that regex, you have to escape the backslash:

    'io\\.'
    

    The way you wrote it, the string actually contains io., which correctly matches function.

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

Sidebar

Related Questions

From the node REPL thing, > d = {} {} > d === {}
Just want to know how to read an attribute of a parent node from
I have the following node I need to parse using XSLT 1.0 from xml
From the node REPL: > JSON.parse('{key : value}') { key: 'value' } > JSON.parse('{key
Directly from the node REPL: > d1 = {key : value} { key: 'value'
I'm working on a project in which I need to produce messages from node.js
can i perform select single node from IXMLDOMElement ,if its possible give me one
Using C# How do you remove a specific node from an XMLDocument using XPATH?
I'm trying to remove a specific node from a XmlNodeList named listaWidths. This specific
I'm looking for solution to extract some node from large xml file (using xmlstarlet

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.