• 11
• 14
• 12
• 10
• 11
• ### Similar Content

• By Alexia
Hi all,
A small team are currently undertaking a fairly large game project involving multi-playing, taming and other complex game mechanisms.
We are looking for someone who is experienced in programming a wide range of mechanisms, more information is on our discord server. It is also a learning experience and we wouldn't expect you to know how to do everything we wanted, but just ask that you would be willing to learn how to.
If you are interested in joining the (rather long term project) just message me and i'll add you on discord.
Thanks for your time,
Alexia

• I'm a formally trained composer (doctorate from Michigan State) who writes what most people would call avant-garde concert music. I love weird abstract projects, and I would like to work with somebody making a weird, abstract, artsy game.
You can find more about me and my music on my site. I have worked with acoustic and electronic sounds, including some procedurally generated and interactive computer music.
In particular, I would like to work on a project that lets me use Fmod to prepare an adaptive score for a game built on Unity or Unreal. I've been a music professor and would like to get experience working in this medium so that I can be a better mentor for my students. Send me a DM or email <davidjohnmacdonald@gmail.com> if you would like to discuss working on a project together.
• By Tuner_z

Name: One Level: Stickman Jailbreak
Price: Free
Developer: RTU Studio
Platform: Android
Language: C# (Unity3D)

Hello!
I want to show you my game! "One level: Stickman Jailbreak" is a puzzle game with unusual gameplay where you must help the character to escape from prison. You just need to take the key and get out alive. The game has only one level, and there are many ways to complete it. Not everything is as simple as it might seem at first glance, so there are clues in the game.

Short description:
Nobody escapes from here!

Description:
Tommy got into trouble again! Our hero is behind bars. But he's not going to stay in jail for a long time and he decides to escape. Tommy steals a key and gets out of the jail cell. But our friend doesn't go free: Tommy suddenly finds himself in the same room from which he just escaped! The conditions for escaping change every time. In order to go free Tommy will have to solve logical puzzles and you can help him in this!
At first it will be easy, but the tension will increase, and the tasks will become more complicated with each level. You should use your brain for all 100%, but if your skill is not enough, you can use a hint or ask for help from friends!
You can solve the puzzles alone or with your friends and spend time well!

Features:
Features:
- 48 unique levels;
- the game is translated into 10 languages: English, French, German, Spanish, Italian, Portuguese, Russian, Japanese, Chinese, Korean;
- the function of "help from friend";
- hints;
- instructions.

Trailer:

Screenshots:

• Hello forum,
I have some decent amount of experience in Unity making games for Software Engineering projects in college, these were very specific projects however and I still am fairly new to building games. I wanted to make a game that uses the shadows of objects for collision detecting (i.e. shooting a gun at a characters shadow causes that character damage. What is the best engine to do this in (game will be 3D), and does anyone have any advice on how to approach this concept? I consider myself fairly experienced in programming, but game dev is just an entirely different beast.
• By juicyz
Hey all,
I've been slowly working on my game called AotW for a while now.  I have come to the conclusions that it would be nice to cooperate with 1 or 2 others to help finish it.  Ive been trying to keep my GDD up to date with my ideas and development so that would give a better overview of the game when the time comes.  Currently I have a basic skeleton of the RPG elements needed but everything can still be discussed and talked about and we can transform my idea to something the group likes.
The premise of the game is a Diablo-like procedurally generated map with RPG elements that include sockets, inventory, classes, abilities, crafting, loot, items, sockets, and enchanting.  This will be done in a 2D iso view as I can't do 3D art and I enjoy 2D games a lot.

I don't plan on releasing this as this is more of a hobby project for me and I have a full-time job.  Though I'd like to start putting more hours into development and having others definitely will be motivation.  I also want to be able to say I have finally "finished" a game idea to some degree.  If the time comes and we want to release it, then we can go ahead and do so but that's not my purpose or plan.

Discord:
Juicyz#3683

Thanks,
Juicyz

# Unity [java] I need some help with regex...

This topic is 3827 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

Hello all, Alright, since most of you will suspect this, I'll just say it. This is for a homework problem, but regex isn't part of the homework. They want us to parse a file by reading in each line and then parse it manually by going through each character. I am trying to do it using regular expressions just because it seems to be a more elegant solution and a good opportunity to learn about them. Ok, so the file contains info about books in this format: "The title goes here" [publishing year] [price] "Author's name here" The quotes are actually there around the title and the author. So, I'll start with the title, I am doing something like this: String title = lineScan.next("\".*\""); where lineScan is a Scanner object for the current line in the file. That expression \".*\" means a string with at least one character between quotes right? But when I run this, it throws a "java.util.InputMismatchException" exception. It works if I do this though: lineScan.useDelimiter("\""); String title = lineScan.next(); But then I try and change the delimiter back to whitespace like this: lineScan.useDelimiter("\\s+"); That means any number of spaces doesn't it? but then it throws a NumberFormatException because it reads in extra whitespace it looks like. Anyway, can anybody give me some help with this? I have read the Java API docs on regular expressions, the scanner object, all that; but I could have missed or misunderstood something. Thanks, Svenjamin

##### Share on other sites
Ugh, the regex and string escapes...

The regex string you're looking for can be written in single line. As it happens, the Scanner tutorial gives you the source:
Scanner s = new Scanner(input);        s.findInLine( ??? );        MatchResult result = s.match();        for (int i=1; i<=result.groupCount(); i++)            System.out.println(result.group(i));
The ??? is what you must figure out - and yes, it's a single string.

The problem with quoted text is that by matching ., quote apparently gets matched too. Hard to tell, since there's no output. So to match everything within quotes, search for just that - "everything that is not quote".

If you want to match something, the it'll usually be in the form: " (\\d+) " - everything outside of () will be matched literally.

So your final expression will look something like the Scanner example:
"\"(???)\" [(???)] [(???)] \"(???)\"";

??? is for you to find out - those are the regexes that will match the variable parts, I'm telling too much already.

Also - homework may or may not be about exceeding yourself. Sometimes, getting something done on your own matters more, so an elaborate solution you cannot fully explain (and regex is a very annoying topic) might not have the expected results.

##### Share on other sites
Hey, Thanks for the quick reply.
I think I can figure it out now, I didn't even think that the . might include quotes as well. Thanks for pointing that out. Thanks for not giving the solution as well, I will enjoy figuring it out myself.

Also, I appreciate your advice about homework, But this is just an intro to Java course. I have been doing C++ for a few years, so there is nothing new conceptually and I enjoy trying to make things harder this way. But again thanks for the advice.

Thanks again for the help,
Svenjamin

##### Share on other sites
Ok, I'm back. I think I've got the expressions I'm going to use figured out, but I'm having some trouble implementing them. I have been testing different expressions using this program.
So to extract the title which is surrounded by quotes I use this expression:

\"[\w[\s]]+\"

And that works like a charm in the test program, but then when I try and write it into my code like this:

String title = input.next("\"[\\w[\\s]]+\"");

I still get the input mismatch exception.
I also tried just printing out the results using the method in the example that you pointed out, but it throws another exception saying that no results were found.
Is there something I am missing when putting the expression into the code?

Thanks,
Svenjamin

##### Share on other sites
I think you have to escape your backslashes as well as the quotes because \" is also a escape for c strings (which I assume is the same for Java, BTW, sorry about my Java ignorance [smile])

so try:

String title = input.next('\\"[\\w[\\s]]+\\"');

or

String title = input.next("\\\"[\\w[\\s]]+\\\"");

Edit: This post has been heavily modified from the original because I found more problems than the ones I first noticed.

##### Share on other sites
Thanks for the reply Kwizatz,
Unfortunately, the first method you suggested doesn't compile in java, only one character can be between single quotes. And the second method still throws the exception. Thanks for trying though, I appreciate it.

Svenjamin

##### Share on other sites
Quote:
 Original post by KwizatzI think you have to escape your backslashes as well as the quotes...

No.

The issue is that regex, by default, is greedy. For example:
# this is Perl, because regex is most elegant in Perl [smile]$str = "\"Ponderous Book Title: Opaque Subtitle\" [2007] [100] \"Sonaiya, Oluseyi\"";$str =~ /\".*\"/;print "$&\n"; The output is "Ponderous Book Title: Opaque Subtitle" [2007] [100] "Sonaiya, Oluseyi". The regex will match any character, as indicated by .* until matching the next character would break the regex. What I need to do is tell it to match the smallest valid sequence, or make it non-greedy: # this is Perl, because regex is most elegant in Perl [smile]$str = "\"Ponderous Book Title: Opaque Subtitle\" [2007] [100] \"Sonaiya, Oluseyi\"";$str =~ /\".*?\"/; # NOTE THE QUESTION MARK!print "$&\n";

The output this time is "Ponderous Book Title: Opaque Subtitle".

Enlightenment beckons (with help, if your Perl-fu is weak).

##### Share on other sites
Alright, what you are saying about greediness and that makes sense, but I didn't think it would matter since neither \w nor \s match the double quote character right? So wouldn't it terminate anyway as soon as it hits the second quote?

Aside from that, I tried this:

input.next("(\"[\w[\s]]+\"){1}");

but that still didn't work. I'm not sure it is correct syntax though. There seem to be a lot of subtle nuances with regex syntax.

Thanks for the help so far,
Svenjamin

EDIT:

The first title in the file is "The Poky Little Puppy", so I tried doing:

input.next("\"The Poky Little Puppy\"");

And even that threw the exception still. Any insights there?

EDIT 2:
I solved it! (sort of) I gave up on the next() method because it still threw the exception even if I used the exact string for the pattern. Anyway, I used the findInLine(Pattern p) method to extract the different parts.

Thanks for all your help,
Svenjamin

[Edited by - Svenjamin on October 31, 2007 5:17:31 PM]

##### Share on other sites
Quote:
Original post by Oluseyi
Quote:
 Original post by KwizatzI think you have to escape your backslashes as well as the quotes...

No.

The issue is that regex, by default, is greedy. For example:
# this is Perl, because regex is most elegant in Perl [smile]$str = "\"Ponderous Book Title: Opaque Subtitle\" [2007] [100] \"Sonaiya, Oluseyi\"";$str =~ /\".*\"/;print "\$&\n";

This is why I gave a pretty strong hint in:
Quote:
 "everything that is not quote"

Since this is solved now, the expression I used for the original problem was:
s.findInLine("\"([^\"]+)\" \$(\\d+)\$ \$(\\d+)\$ \"([^\"]+)\"");

The "any character" is implied, so for quoted strings, I simply match "not quote".

##### Share on other sites
Quote:
 Original post by SvenjaminAside from that, I tried this:input.next("(\"[\w[\s]]+\"){1}");

You have a lot of superfluous nesting there. \"[\w\s]+\" is sufficient.

Glad you found the execution problem, though. [smile]