JavaScript RegEx to find exactly 4 digits number regex find exact string,regex find exact word,regex find

I have a text similar to the text below. It contains a 4 digits number that follows either digit- or whitespace and is followed by either ., ?, -digit or whitespace.


I need to match all of the digits in the first paragraph but none in the second since those digits do not meet my conditions.

Lorem ipsum 3400-digit, sit amet 5000 consectetur adipisicing elit. Natus, explicabo 6700? Itaque iure ipsum laboriosam, ex nemo delectus iste quia cupiditate digit-9134? Iste nam digit-2456 at voluptate est 8456-digit? At excepturi quis voluptatibus 7500.

Lorem ipsum $5000 dolor sit amet consectetur adipisicing elit. Obcaecati tempora dolorum repellat reiciendis cum soluta deserunt ex voluptatibus, nam illum veniam £5550 quidem aperiam sequi, nostrum sed? Quidem eveniet maiores #5550 autem. https://codepen.io/pen/5000/3454


There are a few similar questions already on StackOverflow. I have gone through some of them(links below), but I still can not do this. Please before marking this question as duplicate, check if your solution finds all the occurrence of the 4 digits number in the first paragraph but none in the second paragraph.

  • regular expression to match exactly 5 digits

  • Regular expression to match integers up to 9 digits

  • RegEx match exactly 4 digits

  • JavaScript: \\d{4} RegExp allows more than 4 digits

Answer:1

node.js/express code var express = require('express'), app = express(), port = process.env.PORT || 3000, path = require('path'); app.use('/public', function (req, res) { res.sendfile(...

node.js/express code var express = require('express'), app = express(), port = process.env.PORT || 3000, path = require('path'); app.use('/public', function (req, res) { res.sendfile(...

I am just confused about how to match two statement like if else of JavaScript in React Native for e.g., if(array.length != null && array.length >= 2){ alert("Array Is Greater Than 2")...

I am just confused about how to match two statement like if else of JavaScript in React Native for e.g., if(array.length != null && array.length >= 2){ alert("Array Is Greater Than 2")...

  1. write condition in excel
  2. write condition in sql
  3. write condition in css
  4. write condition in python
  5. write condition in html
  6. write condition in ngif
  7. write condition in r
  8. write condition in java
  9. write condition in tableau
  10. write condition in c#
  11. write condition in matlab
  12. write condition in angularjs
  13. write condition in oracle

I'm trying to have a page that switches out which component is rendered based off of a pair of navigation buttons. The page is set up like this ReactDOM.render(<Logo/>, document.getElementById(...

I'm trying to have a page that switches out which component is rendered based off of a pair of navigation buttons. The page is set up like this ReactDOM.render(<Logo/>, document.getElementById(...

  1. programmatically change route react
  2. programmatically change route react router
  3. react programmatically change style
  4. react programmatically change props

I am new to ReactJS. I am stuck in one problem. I get textbox value from calling API which has predefined value. but When I try to edit its value then it is not letting me to edit. class ...

I am new to ReactJS. I am stuck in one problem. I get textbox value from calling API which has predefined value. but When I try to edit its value then it is not letting me to edit. class ...