Skip to content

Tag: string

Regex match any of the words separated by slashes

I need to develop a validation pattern for catching any kind from: pdf/csv/xlsx select any separate word is simple: (pdf|csv|xlsx). However, I need to check that any combination with them separated by slash is fine as well. For example, correct flow: Incorrect: Answer You may use this regex: RegEx Demo

Get all possible matches in a regex match (In Java)?

I am using a regex to match few possible values in a string that coming with my objects, there I need to get all possible values that are matching from my string as below, If my string value is “This is the code ABC : xyz use for something”. Here is my code that I am using to extract matchers,

Splitting String by column with regex

This is a String I get as input, but I just need every column, starting with the second column, aka: 1 (second row) 2 and 1 (third row) 1 (fifth row) This String has no fixed size in how many lines there could be or how many columns (columns being split by one space). I think this is fairly easy

How to count count the number of names Java

Hi guys. I’m new to Java, currently learning Strings. I have a task to count the number of names, the length of the name must be at least two, the first letter of the name should start with upper case, the second with lower case. The issue is that I don’t know how to use the Character.isUpperCase(…