Join GitHub today
GitHub is home to over 36 million developers working together to host and review code, manage projects, and build software together.
Sign upHave a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
It happens doing a search and replace with a regex but the groups used in the replace expression are not present in the search expression: search for 'a' replace with '$1' Comment 4 Jaroslav Havlin 2012-12-10 16:55:45 UTC.
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
Comments
commented Feb 3, 2016
I'm getting this sometimes: Didn't have in the previous version. The bug is rather annoying! |
commented Feb 3, 2016
@karato valid bug |
commented Feb 3, 2016
@yegor256 could you provide an example of the entered text ? I can't reproduce the bug on production ... |
commented Feb 3, 2016
@karato assign me please |
added a commit to dmzaytsev/netbout that referenced this issue Feb 3, 2016
referenced this issue Feb 3, 2016
Merged#986 catch exception #988
commented Feb 3, 2016
@rultor release, tag= 2.24 |
commented Feb 3, 2016
@dmzaytsev OK, I will release it now. Please check the progress here |
commented Feb 3, 2016
@dmzaytsev@yegor256 Oops, I failed. You can see the full log here (spent 9min) |
commented Feb 3, 2016
@yegor256 I caught the exception as workaround. @essobedo was be able to open the bout (see #987), however I can't reproduce the bug please share the error logs with the text that causes the exception |
commented Feb 3, 2016
@dmzaytsev I don't see the stack trace any more |
commented Feb 3, 2016
@dmzaytsev the log: |
added a commit to dmzaytsev/netbout that referenced this issue Feb 3, 2016
referenced this issue Feb 3, 2016
Merged#986 quoted replacements #990
commented Feb 3, 2016
@karato please see PR #990 |
commented Feb 3, 2016
@dmzaytsev tagged this issue with 'bug' |
commented Feb 3, 2016
@rultor release, tag= 2.25 |
commented Feb 3, 2016
@dmzaytsev OK, I will release it now. Please check the progress here |
commented Feb 3, 2016
@dmzaytsev@yegor256 Oops, I failed. You can see the full log here (spent 11min) |
commented Feb 4, 2016
@yegor256 since the ticket has no milestone I set it to 3.1 |
commented Feb 4, 2016
@karato assign me please |
commented Feb 4, 2016
@dmzaytsev the task is yours, please proceed |
commented Feb 4, 2016
@dmzaytsev will take a look, thanks |
commented Feb 4, 2016
@dmzaytsev sure, it was yours before, go ahead |
commented Feb 4, 2016
@yegor256 thank you for the ticket reported, I topped your account for 15 mins, transaction 000-6585a348 |
commented Feb 4, 2016
@yegor256 fixed in #990 please close the ticket |
commented Feb 5, 2016
@yegor256 ping |
1 similar comment
commented Feb 6, 2016
@yegor256 ping |
commented Feb 8, 2016
@yegor256 fixed in #990 please close the ticket |
commented Feb 11, 2016
@karato I need more time |
commented Feb 11, 2016
@dmzaytsev no problem, thanks for letting me know |
commented Feb 18, 2016
@yegor256 fixed in #990 please close the ticket |
commented Feb 22, 2016
@ypshenychka please, review this ticket for compliance with our QA rules |
commented Feb 22, 2016
@karato Quality is good. |
commented Feb 22, 2016
@ypshenychka thank you, good quality is always good ;) |
commented Feb 22, 2016
@dmzaytsev I added 10 mins to @ypshenychka (for QA review) in transaction 78316429. Much obliged! I have added 30 mins to your account in payment '78316438', 390 hours and 20 mins spent. +30 added to your rating, at the moment it is: +3392 |
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment
I'm trying to extract the district of some postcodes using regex with the following script in Pyspark:
postcodes.select('raw_postcode', regexp_extract('raw_postcode', '^[a-zA-Z]+dd?[a-zA-Z]?', 1).alias('area')).show(40, False)
I get following exception:
I have tried the regex in Python alone and it works, but it is giving me trouble in pyspark. Help me find out the reason.
ebertbmebertbm
9785 gold badges18 silver badges32 bronze badges
2 Answers
The second argument to
regexp_extract
denotes the number of capturing group the contents of which you want to extract. However, your regex has no capturing groups defined, thus, you need to pass 0
as the second argument. Besides, you may use
[0-9]
instead of d
to avoid issues with escaping.So, you may use
Details
^
- start of string[a-zA-Z]+
- 1+ ASCII letters[0-9]{1,2}
- 1 or 2 digits[a-zA-Z]?
- an optional ASCII letter.
343k16 gold badges160 silver badges241 bronze badges
Menaka SankarMenaka Sankar