

- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Java regex to exclude a specific String constant
regex ^((?!kk).)*$ returns true if a line does not contain kk, otherwise returns false
Example
public class RegTest { public static void main(String[] args) { // TODO Auto-generated method stub String s="tutorials"; boolean i=s.matches("^((?!kk).)*$"); System.out.println(i); } }
- Related Questions & Answers
- How to exclude a specific row from a table in MySQL?
- Regex to ignore a specific character in MongoDB?
- How do I exclude a specific record in MySQL?
- What is string constant pool in Java?
- Java Regex to extract maximum numeric value from a string
- MySQL query to exclude values having specific last 3 digits
- How to exclude specific extension in Get-ChildItem in PowerShell?
- Why String literal is stored in String Constant Pool in Java?
- Extracting each word from a string using Regex in Java
- How match a string irrespective of case using Java regex.
- How to test if a Java String contains a case insensitive regex pattern
- Regex metacharacters in Java Regex
- How to match end of a particular string/line using Java RegEx
- How to match beginning of a particular string/line using Java RegEx
- Java regex program to split a string at every space and punctuation.
Advertisements