问题
I have about 1500 items in an Open Office CSV file like this:
<a href=\http://localhost:81/rare_posts/?attachment_id=9044\"><img class=\"alignright size-medium wp-image-9044\" title=\"200064 British medical association\" src=\"http://localhost:81/books_posts/wp-content/uploads/British-medical-association-300x202.jpg\" alt=\"\" width=\"300\" height=\"202\" /></a>
What I need to do is find just the image (British-medical-association-300x202.jpg) and place this into the next cell. I am assuming there must be some way for me to run a command in Open Office to find all instances of uploads/, the point where we start stripping out all the text after this point and stop at .jpg?
Many thanks!
回答1:
OpenOffice has no formula function to return a match by a regex. It does support regex search if you enable regular expressions in the options.
You can go with two formulas to extract one occurence per cell (without using a regex search). One to find the left end and one to find the right end:
Assuming the data is in A1
B1 =MID(A1;FIND("uploads/";A1)+8;LEN(A1))
C1 =LEFT(B1;FIND("\";B1)-1)
If you have more than one occurence per cell, you can clone the formulas and supply the first FIND
a third parameter, where to start searching (past the first occurence).
来源:https://stackoverflow.com/questions/13061475/how-to-extract-file-name-from-random-image-img-tags-in-open-office