-
Notifications
You must be signed in to change notification settings - Fork 12
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
Document matching end of line #30
Comments
Use the function to match the whole line, and include the equivalent of |
Not sure if this is a good idea, as it isn't very composable. Say I want to match |
Well, it is the way at the moment. I don't have the resources to investigate whether and how this can be implemented, but you can look into it yourself if you wish. |
I wanted to remove 'index.html' from string. I found out that the following code was working:
By generalizing this, can we solve this issue? |
@demokritos why do this instead of #30 (comment)? |
Did you mean this? stripIndex :: String -> String
stripIndex str = fromMaybe str $
match ((\a b c -> a ++ b : c) <$> many anySym
<*> sym '/'
<* string "index.html"
<*> (concat <$> many query)) str
where
query = (:) <$> (sym '#' <|> sym '?') <*> many (psym (/= '/')) I didn't know that I wonder whether the syntax below is possible by introducing special boundary indicators. stripIndex = replace ((:) <$> sym '/'
<* string "index.html"
<*> (concat <$> many query)
<* EndOfLine) Thanks. |
Yeah, I think it could be possible. My answer is the same as 4 years ago (wow, time flies!): I'd consider a carefully motivated and implemented pull request, but I don't have the resources to look into this myself. |
I couldn't find an example on how I match
[0-9]+[.][0-9][0-9]$
- that is, match something at the end of a line.The text was updated successfully, but these errors were encountered: