Skip to main content

All Questions

Tagged with
Filter by
Sorted by
Tagged with
4 votes
2 answers
1k views

Add a number to a file name if does not exist or increase the number if it exist

I'm currently working on a solution to add a number to a file name if the number does not exist or increase de number by one if the number exist. For instance if you input "filename.jpeg" ...
Mario's user avatar
  • 41
7 votes
7 answers
3k views

DnD Die in Java with regex

For my game I need to roll some values with a die. A die is formally described as: nDs[+a] n amount of die (optional, 1 of not set, zero must be set explicitly) D ...
Martin Frank's user avatar
  • 3,023
0 votes
2 answers
153 views

Parse file and make output in custom List [closed]

I have a file output like this and want to do parsing and put the output into a List. The biggest problem here is the name of a wake-lock which appears after ID and runtime, in some cases, it contains ...
Danijel Markov's user avatar
3 votes
1 answer
101 views

Listing words from text, provide lines where appears, count them

I applied for Junior Java Developer in some company. Got a task:"Listing words (without duplicates) from text, provide lines where appears, count them." Output should looks like: Alphacoronavirus - 3 ...
Konrad's user avatar
  • 33
3 votes
3 answers
176 views

Java regex and replaceAll to extract strings into objects

I have this method that creates book objects. I pass a list of strings (size 60000+) that contain the information of the book, the function then goes and extracts the information makes the book object ...
Rob's user avatar
  • 63
4 votes
1 answer
133 views

Simplifying Regex Expression: calendar

I want to parse a date string with the following general format: Weekday, DD-Mon-YYYY HH:MM:SS. The calendar should also accept: a date without the weekday spaces instead of dashes case-insensitive ...
Rika's user avatar
  • 41
2 votes
1 answer
174 views

Converting HashMap data to a Response object

I have a HashMap and I want to convert data in it to a Response object. Is it possible to achieve this code that parses the string in a better and optimized and cleaner way, maybe by using streams? <...
tech_ques's user avatar
3 votes
1 answer
2k views

Validate URL with Regex and java.net.URL

I'm writing a URL validator. Firstly, it checks for special characters in the input. Secondly, it adds 'http://' and checks for validity. ...
Rasela Don's user avatar
3 votes
2 answers
101 views

Minimizing a file path

I have a simple program that "minimizes" a file path. Minimizing simply means replacing unnecessary file entries with entries that mean the same thing: ...
Charanor's user avatar
  • 181
-1 votes
1 answer
3k views

Java Pattern search with variable string in pattern [closed]

Is there any better and compact way to write this code: ...
S.K.'s user avatar
  • 101
2 votes
1 answer
162 views

Java Regex for Chess notations

I have this regex: (\d?)[A-Za-z](?=(\d?)(.*))(?=(.* ){5}) It would be used by me for Chess FEN strings. I wonder if regex ...
Superluminal's user avatar
3 votes
1 answer
369 views

Regular Expression for text that validates IPV4 or Hostname followed by a port number eg: 127.0.0.1:8080 or localhost:8080

An attempt with regular expression to do a foolproof validation of an IV4 or Hostname:port Number. Example texts that can be validated for any of the following: ...
Thomas Mathew's user avatar
5 votes
2 answers
219 views

Regex-based parsing of a specifier for dice

In this android app, the user can enter (a subset of) roll20 notation to roll that many dice. Inputs will look like "4d6" at the simplest, but the user can also add or subtract numbers, and drop or ...
RWeb's user avatar
  • 51
3 votes
1 answer
1k views

Pig Latin game resolved with a regex in Java

I recreated the Pig Latin game on Java. The program takes an arbitrary number of command line arguments as words, and prints to the standard output these words translated with following rules: For ...
user avatar
3 votes
1 answer
178 views

Parser and solver for percentage calculation problems

I'm working on a coding challenge to help with regular expressions, and how to write better comments in my code. The class parses a percentage question, and can return the answer. If anyone has any ...
user1154644's user avatar

15 30 50 per page
1
2 3 4 5
7