Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Java Java Data Structures Organizing Data Splitting Strings

Can anyone tell me how often the REGEX thing is actually used?

I am here to learn Java, and that is why I chose the track. I honestly feel that there is waaay too much stuff getting in the way of that. Heck, even the instructor in this video brought up how distracting the REGEX stuff could be while trying to learn Java, so why in the heck are we using it??! Honestly, the whole thing of having to learn REPL, JSHELL, and now REGEX or whatever the heck that was takes away from the efficiency of learning the actual subject matter of Java.

My question is, especially to those that are actually out there coding in the real world, how often do you use this whole REGEX thing and whatever we did in this video? Lol I have no other way to describe it as I am totally lost with what we did (or at least what was supposed to have been done....

2 Answers

Hey Micheal, Yes REGEX can be hard, but don't let that distract you from learning java. REGEX is not only used in java. It can be used anywhere. We use at my work which is completely based on the .NET framework. WE use REGEX simply to validate incoming data. The incoming data has to meet different formats for the various clients. So a different REGEX is configured for each client to validate certain parts of the data. But again, don't let that distract you from actually learning java, especially when you are just starting out. It is good that you know REGEX exists and know what it is mostly used for. Validation Rules.

None of us at work know everything about REGEX so this is a good website to create and test your regular expressions. https://regex101.com/

Hope this helps.

Dan Bearden
Dan Bearden
24,231 Points

Developers use regex all the time all over the place in their stacks. For a really simple example, think of a form validation class. We would want to take the fields off a form and only submit the form if the fields contained proper values in them. In order to know that the email field was proper, a regex is an awesome way to ensure the value matches the pattern of an email address. This doesn't really come down to a Java thing, but rather a common practice for any language. In this form validation example, I could be doing this validation on the frontend through Javascript, through a PHP class, even in C# or Java as well.