Xtext - Check whether string is URL

前提是你 提交于 2019-12-08 09:23:39

问题


I'm completely new to Xtext so thanks in advance for your help.

I have the following:

terminal PATTERN_SRC : STRING '.png';
Pattern: name='pattern:' value=PATTERN_SRC;

I want the user to code it like this:

pattern: (URL to image ending with .png / .jpg / .gif)

Currently I'm checking it like this but this does not work.

Is there a nice way to solve this? Thanks in advance!


回答1:


Sone remarks:

Don't use the feature name. This is a reserved keyword for calculating unique names of an element in a resource.

STRING is like this: "Sometext". So what you want is "somefile.png" What you described is "somefile".png You could just use STRING and implement a validation rule to ensure your URL is valid.



来源:https://stackoverflow.com/questions/58957140/xtext-check-whether-string-is-url

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!