Snippets tagged “regex”
19 snippets use this tag.
- Check and extract a number from a String in JavaJava
To check if a string contains a number and extract the number from the string in Java, you can use a combination of the matches method of the String class and the find method of the Matcher class.
- How can I prevent java.lang.NumberFormatException: For input string: "N/A"?Java
java.lang.NumberFormatException: For input string: "N/A" occurs when you try to parse a string that cannot be converted to a number, such as the string "N/A".
- How to Check If a String Contains Another Substring in JavaScriptJavaScript
Read this tutorial and learn several methods used to check if a string contains another substring in JavaScript or not. Read information and see examples.
- How to Check Whether a String Matches a RegEx in JavaScriptJavaScript
Read and learn two methods used to check whether a string matches RegEx in JavaScript. Also, see which method is the fastest and differences between them.
- How to Count the Pages in a PDF File with PHPPHP
PHP provides a range of extensions and functions for getting the number of pages in a PDF document. Let’s check out the most efficient ones, here.
- How to extract a substring using regexJava
To extract a substring from a string using a regular expression in Java, you can use the following steps:
- How to Get Query String Values in JavaScriptJavaScript
On this page, you can find fast and simple solutions on how to get query string values in JavaScript. Just follow the examples given below to make it work.
- How to match "any character" in regular expression?Java
To match "any character" in a regular expression, you can use the . (dot) character. The . character matches any single character, except for a newline.
- How to Remove Spaces From StringJavaScript
Read this JavaScript tutorial and learn several methods that are used to remove spaces from a string. Also, know which is the fastest method to choose.
- How to Replace a Word Inside a PHP StringPHP
Sometimes, it is necessary to replace a given word inside a string in PHP. Here, we will consider three helpful functions that help to carry out the task.
- How to Validate an E-mail Using JavaScriptJavaScript
Read this tutorial and learn a fast and easy solution to the issue of validating an email using JavaScript. Also, you will read about what the email is.
- How to Validate an Email with PHPPHP
This tutorial explains how to validate an email using the PHP arsenal. Check out the examples of how to do that with the help of a PHP function and regex.
- PHP Regex to get youtube video ID?PHP
You can use the following regular expression to extract the YouTube video ID from a URL:
- PHP/regex: How to get the string value of HTML tag?PHP
In PHP, you can use the preg_match() function to extract the string value of an HTML tag.
- Python string.replace regular expressionPython
You can use the re module in Python to use regular expressions with the replace() method.
- Regex pattern including all special charactersJava
To create a regular expression that includes all special characters, you can use the following pattern:
- reliable user browser detection with phpPHP
There are several ways to detect a user's browser using PHP.
- string to string array conversion in javaJava
There are several ways to convert a string to a string array in Java. Here are a few options:
- Whitespace Matching Regex - JavaJava
In Java, you can use the following regular expression to match any amount of whitespace: