March 9, 20169 yr Hello, i try to delete a paragraph or sentence if it contains a sting for example Quote The prologue of Romeo and Juliet calls the title characters “star-crossed lovers” And the stars do seem to conspire against these young lovers Romeo is a Montague, and Juliet a Capulet Their families are enmeshed in a feud, but the moment they meet when Romeo and his friends attend a party at Juliet’s house in disguise he two fall in love and quickly decide that they want to be married in this field i would like to delete all sentence containing string "romeo" so the result should be : Quote And the stars do seem to conspire against these young lovers Their families are enmeshed in a feud, but the moment they meet he two fall in love and quickly decide that they want to be married Thanks you Edited March 9, 20169 yr by ibobo
March 9, 20169 yr 44 minutes ago, ibobo said: i try to delete a paragraph or sentence if it contains a sting There is a big difference between a paragraph and a sentence. Filemaker knows what a paragraph is (technically, it's a value in a return-separated list), but it has no concept of a sentence. To remove values containing a string, make your script loop over them and return only those that do not, for example: Set Variable [ $text; Value:Table::Source ] Loop Set Variable [ $i; Value:$i + 1 ] Exit Loop If [ $i > ValueCount ( $text ) ] Set Variable [ $para; Value:MiddleValues ( $text ; $i ; 1 ) ] If [ not PatternCount ( $para ; "romeo" ) ] Set Variable [ $result; Value:$result & $para ] End If End Loop Set Field [ Table::Target; $result ] Edited March 9, 20169 yr by comment
March 9, 20169 yr Author Thanks you a lot Comment ! it works perfectly last think if i want add to Romeo many other strings like Juliet, Freud, ..?
March 9, 20169 yr 3 minutes ago, ibobo said: if i want add to Romeo many other strings like Juliet, Freud, How many? And where do you want to keep them?
March 9, 20169 yr Author a lot, like 100 -/+, and keep where it s the best ? maybe if i put them in a field with different table and PatternCount take it each and loop ?
March 9, 20169 yr 57 minutes ago, ibobo said: maybe if i put them in a field with different table That would seem most suitable. See the attached: Loop2.fp7
March 14, 20169 yr Author Hi Comment, do you know if i could add that the script that you made : delete also previous paragraph ? for exemple : Quote And the stars do seem to conspire against these young lovers Their families are enmeshed in a feud, but the moment they meet he two fall in love and quickly decide that they want to be married if content "two" delete the same paragraph and the previous paragraph. like this : Quote And the stars do seem to conspire against these young livers (deleted because previous to "two" (deleted because of content "two" Thanks
March 14, 20169 yr I believe it would be easier to discard a paragraph when it or the next paragraph contain the search string. To do this, you can change the definition of the $match variable to = PatternCount ( MiddleValues ( $text ; $i ; 2 ) ; GetValue ( $values ; $j ) )
Create an account or sign in to comment