Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

112 Create skeleton for regex #118

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
tboychuk merged 5 commits into main from 112-crazy-regex-exercise
Nov 5, 2021
Merged

112 Create skeleton for regex #118

tboychuk merged 5 commits into main from 112-crazy-regex-exercise
Nov 5, 2021

Conversation

Copy link
Contributor

@Meitoseshifu Meitoseshifu commented Oct 26, 2021

No description provided.

Copy link
Contributor

@tboychuk tboychuk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Meitoseshifu very nice exercise overall 👍
Please take a look and address my comments. Next time I guess it makes sense to create a completed PR as well.

# <img src="https://raw.githubusercontent.com/bobocode-projects/resources/master/image/logo_transparent_background.png" height=50/>Crazy Regex

### Objectives
You're supposed to know how to work regex and be able to build Patterns and Matchers
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Objectives mean the learning goals of this exercise. What you specified here is prerequisites

*/
public class CrazyRegex {

/**
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Meitoseshifu every javadoc starts from Create Pattern that accepts String with regex inside and can * find which makes it redundant. You can simplify it, e.g. A pattern that finds a specific word.

* Create Pattern that accepts String with regex inside and can
* find all words "Curiosity" in text
*
* @return Pattern with regex expression
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Meitoseshifu it doesn't make sense to have the same
@return Pattern with regex expression
Let's replace it with @return a compiled Pattern instance that looks for the word "Curiosity" or
@return a pattern that looks for the word "Curiosity"

throw new ExerciseNotCompletedException();
}

/**
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Meitoseshifu I believe it makes sense to provide some examples inside javadoc. A text and then what should be the result if you use this pattern to find the matches. In this method, I wasn't sure what means "all numbers". E.g. if I have in the text 25th of October then should "25" be found or not? It can be explained in the example.

throw new ExerciseNotCompletedException();
}

/**
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Meitoseshifu since it's not necessarily clear what is a zip code, it would be nice to have an example here as well.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Or at least explanation: "a zip code is a 5-digit number without any characters or special symbols,"


@Test
@Order(14)
void findAbbreviation() {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Meitoseshifu the test will pass with this regex [A-Z]{2}. I'm not sure if this is what you've been looking for.

throw new ExerciseNotCompletedException();
}

/**
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would be good to have an example.

* Create Pattern that accepts String with regex inside and can
* find all http links inside ()
*
* @return Pattern with regex expression
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Meitoseshifu it would be good to have an example, because it's not clear why links are inside ().


@Test
@Order(16)
void findOnlyResources() {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Meitoseshifu why square brackets are also a part of the result? I guess we should find only the resource e.g. Google, and not [Google].

@Order(17)
void findOnlyLinksInNote() {
String result = regexChecker(crazyRegex.findOnlyLinksInNote(), text);
assertThat(result).isEqualTo("\n(https://google.com)\n(https://stackoverflow.com)" +
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Meitoseshifu same here, why (https://google.com) not https://google.com?

@tboychuk tboychuk merged commit 4a111c1 into main Nov 5, 2021
@tboychuk tboychuk deleted the 112-crazy-regex-exercise branch November 5, 2021 13:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Reviewers

@tboychuk tboychuk tboychuk approved these changes

Assignees
No one assigned
Labels
None yet
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

AltStyle によって変換されたページ (->オリジナル) /