Skip to content
Advertisement

Tag: regex

If I use string.contains() on a string that may have regular expressions [closed]

Closed. This question needs details or clarity. It is not currently accepting answers. Want to improve this question? Add details and clarify the problem by editing this post. Closed 1 year ago. Improve this question If I use string.contains() on a string that may have regular expressions, will the regular expressions trigger? For example string.contains(“alphawbet”). Am I right in thinking

Convert String to Hashmap in Java

I have the following string: I want to convert it back to hashmap. I tried the following code below but the problem is that it can’t convert the string with spaces. It outputs something like this: I think it has something to do with the regex. Help! Thanks. Answer Something like this will work for you :

Regular Expression in burp

I’m using a forward proxy called Burp and would like to see only results from google in my site scope. What will be the regex for if i want to see *.google.* in my result So sample output can be and so on Answer This should work for you: Will match anything before and after .google.

Validate page numbers/ranges for printing

I am writing a regular expression for matching a particular pattern which is as follows. We all are familiar with the pattern that we give while printing selective pages via a word document. i.e. We can use comma and hyphen no other special characters allowed should start and end with a number Comma and hyphen not allowed together, etc Valid

How to return a string which matches the regex in Java

Here is a method which returns true/ false for each match. Instead I want to get the matched string if it matches. If it doesn’t matches then don’t return. I can have an If condition to check if its true or false. But my specific question here is, how to return the string if it matches? Answer How to get

On Which Line Number Was the Regex Match Found?

I would like to search a .java file using Regular Expressions and I wonder if there is a way to detect one what lines in the file the matches are found. For example if I look for the match hello with Java regular expressions, will some method tell me that the matches were found on lines 9, 15, and 30?

Regular expression – allow space and any number of digits

my valid string should be either “1234” or ” 1234″ allow one or zero space at the beginning then followed by any number of digits only so what should be the regular expression for this ? Answer You can use this: which is easier to read like this: See demo. To test if you have a match, you can do

Advertisement