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

Extract a pattern from a rich text field #834

Open
allnode opened this issue Sep 27, 2017 · 0 comments
Open

Extract a pattern from a rich text field #834

allnode opened this issue Sep 27, 2017 · 0 comments

Comments

@allnode
Copy link

allnode commented Sep 27, 2017

I have a rich text field, richtext that contains text and an image html image tagged fragment such as the following:

Spectacular Mountain etc etc
<img src="pic_mountain.jpg" alt="Mountain View" style="width:304px;height:228px; />

I wanted to create a Computed for Display field that returns just the image fragment. I found the following code would work:

import re
pat = '<img .+ />'
match = re.search (pat, richtext)
return match

at a standalone python session. But if I used the code in plomino, the import re instruction is not allowed. Any suggestion how I can do this?

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

1 participant