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

Mutiple img tag Regex fix. #234

Merged
merged 4 commits into from
Aug 3, 2021
Merged

Conversation

danieljfrench
Copy link
Contributor

Issue
I had a requirement to be able to put multiple img elements sequentially in a post. When submitted and run through the textparsingservice, the regex logic was only finding the last img tag, and replacing with the forum [image] code. The Regex was being too greedy.

Fix
The "greediness" of the Regex has been changed to allow it to match multiple img tags (.? rather than .). This SO post helped with determining what was happening: https://stackoverflow.com/questions/2301285/what-do-lazy-and-greedy-mean-in-the-context-of-regular-expressions.

Testing
Have tested locally with sequential and non-sequantial images and the issue seems resolved.

Allow multiple img tags to be replaced with [image] tags.
@danieljfrench danieljfrench changed the base branch from main to v17.x August 3, 2021 12:30
@jeffputz
Copy link
Collaborator

jeffputz commented Aug 3, 2021

@danieljfrench thanks for the PR... can you add unit tests, please?

dan-french and others added 2 commits August 3, 2021 16:00
@danieljfrench
Copy link
Contributor Author

@jeffputz - no problem, added now. Two new unit tests added to src/PopForums.Test/Services/TextParsingServiceClientHtmlToForumCodeTests.cs

@jeffputz jeffputz merged commit 9f0ba4b into POPWorldMedia:v17.x Aug 3, 2021
@danieljfrench
Copy link
Contributor Author

@jeffputz - thanks Jeff. Any chance of the v17.x nuget feed being updated?

@jeffputz
Copy link
Collaborator

jeffputz commented Aug 4, 2021

@danieljfrench yeah, I'll have to push a new release. Give me a little time on that today...

@jeffputz
Copy link
Collaborator

jeffputz commented Aug 4, 2021

@danieljfrench v17.0.1 for the core library is up on Nuget. Thank you for your help!

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

Successfully merging this pull request may close these issues.

3 participants