{"action":"created","issue":{"url":"https://api.github.com/repos/languagetool-org/languagetool/issues/373","repository_url":"https://api.github.com/repos/languagetool-org/languagetool","labels_url":"https://api.github.com/repos/languagetool-org/languagetool/issues/373/labels{/name}","comments_url":"https://api.github.com/repos/languagetool-org/languagetool/issues/373/comments","events_url":"https://api.github.com/repos/languagetool-org/languagetool/issues/373/events","html_url":"https://github.com/languagetool-org/languagetool/issues/373","id":140794793,"number":373,"title":"text in suggestion is ignored when match and regexp is used.","user":{"login":"srtxg","id":17380179,"avatar_url":"https://avatars2.githubusercontent.com/u/17380179?v=4","gravatar_id":"","url":"https://api.github.com/users/srtxg","html_url":"https://github.com/srtxg","followers_url":"https://api.github.com/users/srtxg/followers","following_url":"https://api.github.com/users/srtxg/following{/other_user}","gists_url":"https://api.github.com/users/srtxg/gists{/gist_id}","starred_url":"https://api.github.com/users/srtxg/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/srtxg/subscriptions","organizations_url":"https://api.github.com/users/srtxg/orgs","repos_url":"https://api.github.com/users/srtxg/repos","events_url":"https://api.github.com/users/srtxg/events{/privacy}","received_events_url":"https://api.github.com/users/srtxg/received_events","type":"User","site_admin":false},"labels":[{"id":51266621,"url":"https://api.github.com/repos/languagetool-org/languagetool/labels/bug","name":"bug","color":"fc2929","default":true}],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":5,"created_at":"2016-03-14T20:53:50Z","updated_at":"2018-03-11T08:41:22Z","closed_at":"2018-03-11T08:41:22Z","author_association":"NONE","body":"Hello, I discovered what seems to be a bug.\n\nI need to catch some incorrect constructions like \"nel vola-t i nén\" and suggest the proper \"vo nel la-t i nén\".\nFor detecting the wrong construct I use a <regexp>[Nn](' el|el|i l') ((ri?|)vo?(la|ci|cial|chal))(-t i|-t ele|) nén</regexp>\n\nNow, if I just use a suggestion with a text with \\1 \\2 etc, it works correctly;\nbut in some case, I would need to do an extra transformation.\nWhen the matching is done with \"token\", then I can have a suggestion with text, and \"match\" with regexp_replace in it; it works correctly.\nBut if I try that when the match is done with \"regexp\", then everything inside the \"suggestion\" but outside the \"match\" is ignored.\n\nHere are some test rules to reproduce it.\n\n```\n<rulegroup id=\"TESTS\" name=\"Rîles di saye\">\n        <rule id=\"TEST_01\" name=\"xnel vola -> vo nel la\">\n            <regexp>[Xx][Nn](' el|el|i l') ((ri?|)vo?(la|ci|cial|chal))(-t i|-t ele|) nén</regexp>\n            <message>Test 01: <suggestion>vo <match no=\"1\" \n                                    regexp_match=\"[Xx].* (ri?|)vo?(la|ci|cial|chal)(-t i|-t ele|) nén\"\n                                    regexp_replace=\"nel $1$2$3 nén\"/></suggestion>.</message>\n            <example correction=\"foo nel la-t i nén\"><marker>xnel vola-t i nén</marker> co.</example>\n        </rule>\n        <rule id=\"TEST_03\" name=\"znel vola -> vo nel la\">\n            <pattern>\n                <token regexp=\"yes\">znel</token>\n                <token regexp=\"yes\">(ri?|)vo?(la|ci|cial|chal)</token>\n            </pattern>\n            <message>Test 03: <suggestion>vo <match no=\"1\" case_conversion=\"startlower\"\n                                    regexp_match=\"[zZ](nel)\" \n                                    regexp_replace=\"$1\"></match> <match no=\"2\" \n                                    regexp_match=\"(ri?|)vo?(la|ci|cial|chal)\" \n                                    regexp_replace=\"$1$2\"></match></suggestion>?</message>\n            <example correction=\"vo nel rila\"><marker>znel rvola</marker>-t i nén co.</example>\n        </rule>\n    </rulegroup>\n```\n\nrule 01 catches correctly \"Xnel vola nén\" but suggest \"nel la nén\" (the leading \"Vo \"  disappears, and capitalization is wrong ).\nrule 03 catches correctly \"'(Znel vola) nén\" and correclty suggest \"Vo nel la nén\" (the problem is that I will need between 2 and 4 rules using <token> to catch the same complex patter as a single <regexp>, due to the apostrophes; that was the reason I looked at a rule with <regexp> to make it simple).\n\nAnyway, we can see the behaviour of the <suggestion> part is inconsistent, in test 01 the \"vo \" part is ignored, in test 02 it properly displays.\n"},"comment":{"url":"https://api.github.com/repos/languagetool-org/languagetool/issues/comments/372098889","html_url":"https://github.com/languagetool-org/languagetool/issues/373#issuecomment-372098889","issue_url":"https://api.github.com/repos/languagetool-org/languagetool/issues/373","id":372098889,"user":{"login":"danielnaber","id":857004,"avatar_url":"https://avatars1.githubusercontent.com/u/857004?v=4","gravatar_id":"","url":"https://api.github.com/users/danielnaber","html_url":"https://github.com/danielnaber","followers_url":"https://api.github.com/users/danielnaber/followers","following_url":"https://api.github.com/users/danielnaber/following{/other_user}","gists_url":"https://api.github.com/users/danielnaber/gists{/gist_id}","starred_url":"https://api.github.com/users/danielnaber/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/danielnaber/subscriptions","organizations_url":"https://api.github.com/users/danielnaber/orgs","repos_url":"https://api.github.com/users/danielnaber/repos","events_url":"https://api.github.com/users/danielnaber/events{/privacy}","received_events_url":"https://api.github.com/users/danielnaber/received_events","type":"User","site_admin":false},"created_at":"2018-03-11T08:41:22Z","updated_at":"2018-03-11T08:41:22Z","author_association":"OWNER","body":"Should be fixed by @oserikov's commit."}}
{"actor":{"display_login":"danielnaber"}}