Skip to content
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

Open Refine Challenge 6 #2

Open
antsankov opened this issue Sep 18, 2014 · 4 comments
Open

Open Refine Challenge 6 #2

antsankov opened this issue Sep 18, 2014 · 4 comments

Comments

@antsankov
Copy link

I'm having some issues with challenge 6. I'm trying to use the "Add column based on this column" with the expression being like the tutorial:

value.match(/.Professor Of (.)/)[0]

This only returns nulls and my new column is blank. Is there something in particular I am doing wrong?

@dawsbot
Copy link

dawsbot commented Sep 18, 2014

Got it. Think about how many chars you want to catch after "Professor Of". The next char is always a space, so that's all you are currently catching. You only need to add one char to your expression to solve the issue, just figure that out and it's all sweet dreams.

EDIT: Then after the above fix is completed, you need to add yet another character to your regex in order to make phrases work that look like "Assistant Professor Of Political Science". This is a tad different because it does not begin with "Professor Of". Still a simple fix.

@antsankov
Copy link
Author

I'm honestly stumped. I've gotten as far as to modify my regex to:

value.replace(/\(*Professor Of /,"")

My logic being replacing with "" everything that meets the criteria: wild card first, to catch anything before "Professor Of", and then the actual "Professor Of" string.

My problem is that my regex is letting statements like "Assistant Professor Of Political Science" turn into "Assistant Political science"

I am not even sure I am using the right utility. This is "add column based on"? I've spent about 45 minutes on this problem and all I am learning is about how frustrating regex is.

Some teacher comment or some actual code would be appreciated because I have a feeling this is far more complex than it has to be.

@dawsbot
Copy link

dawsbot commented Sep 18, 2014

Bottom left of the screen on my screenshot for this number six has the regex solution:
https://github.com/dawsonbotsford/challenge-week-4

Just separate columns by this regex. Donezo

@antsankov
Copy link
Author

Awesome, thanks Dawson!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants