• python
  • javascript
  • reactjs
  • sql
  • c#
  • java
Facebook Twitter Instagram
Devs Fixed
  • python
  • javascript
  • reactjs
  • sql
  • c#
  • java
Devs Fixed
Home ยป Resolved: JavaScript regex check line break

Resolved: JavaScript regex check line break

0
By Isaac Tonny on 17/06/2022 Issue
Share
Facebook Twitter LinkedIn

Question:

I get information from a database that includes Locker code and is dependent on the orderId. Some orders have a Locker code, which is used to unlock the door when customers pick up their orders from locker storage.
If the locker exist then it will show in UI like this:


I used regex to test the locker code in E2E testing. That regex will match the string “Locker code” and six digits . For that regex match I did like this expect(body).toMatch(/Locker code: [\r\n]+ \[A-Z0-9]+/). But seems like regex match does not work. I believe it is due to the “Locker code” and the use of a 6-digit number string in two different divs. But I can’t say I’m certain. Is there any better way I can test “Locker code” and six digits?

Answer:

You can use this regex to
See the regex demo

If you have better answer, please add a comment about this, thank you!

javascript regex
Share. Facebook Twitter LinkedIn

Related Posts

Resolved: itertools: cycle through several lists N times via iteration

24/03/2023

Resolved: Convert function is not working with {fn } in SQL Server

24/03/2023

Resolved: Why reference in pointer array doesn’t have data?

24/03/2023

Leave A Reply

© 2023 DEVSFIX.COM

Type above and press Enter to search. Press Esc to cancel.