question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

`prefer-starts-ends-with`: Remove `string.match`

See original GitHub issue

We are checking string.match(/^a/), we should not check it, only /^a/.test(string).

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
fiskercommented, Jan 8, 2021

prefer-regexp-test rule has been added, String#match() should be removed.

1reaction
silverwindcommented, May 8, 2020

A rule that reports string.match or regex.exec used in a conditional/boolean context might nice to have. It should suggest regex.test for both.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Remove matched patterns — str_remove • stringr
Use regex() for finer control of the matching behaviour. Match a fixed string (i.e. by comparing only bytes), using fixed() . This is...
Read more >
How to remove text from a string? - javascript - Stack Overflow
You can use "data-123".replace('data-',''); , as mentioned, but as replace() only replaces the FIRST instance of the matching text, if your string was ......
Read more >
Remove text before, after or between two characters in Excel
Remove text after a specific character. To delete a substring before a comma, type an asterisk, a comma, and a space (*, )...
Read more >
How To Remove Characters from a String in Python
Introduction. This article describes two common methods that you can use to remove characters from a string using Python:.
Read more >
Remove a part of a string in Python - nkmk note
Remove a substring by replacing it with an empty string · Remove exact match string: replace() · Remove substrings by regex: re.sub().
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found