def resource_id(string, on_match)
      return '' unless string

      # unquote the string
      # "com.example.Test:id/enter" -> com.example.Test:id/enter
      unquote = string.match(/"(.+)"/)
      string = unquote[1] if unquote

      # java_package : type / name
      #
      # com.example.Test:id/enter
      #
      # ^[a-zA-Z_]      - Java package must start with letter or underscore
      # [a-zA-Z0-9\._]* - Java package may contain letters, numbers, periods and underscores
      # :               - : ends the package and starts the type
      # [^\/]+          - type is made up of at least one non-/ characters
      # \\/             - / ends the type and starts the name
      # [\S]+$          - the name contains at least one non-space character and then the line is ended
      resource_id = /^[a-zA-Z_][a-zA-Z0-9\._]*:[^\/]+\/[\S]+$/
      string.match(resource_id) ? on_match : ''
    end
def resource_id(string, on_match)
      return '' unless string

      # unquote the string
      # "com.example.Test:id/enter" -> com.example.Test:id/enter
      unquote = string.match(/"(.+)"/)
      string = unquote[1] if unquote

      # java_package : type / name
      #
      # com.example.Test:id/enter
      #
      # ^[a-zA-Z_]      - Java package must start with letter or underscore
      # [a-zA-Z0-9\._]* - Java package may contain letters, numbers, periods and underscores
      # :               - : ends the package and starts the type
      # [^\/]+          - type is made up of at least one non-/ characters
      # \\/             - / ends the type and starts the name
      # [\S]+$          - the name contains at least one non-space character and then the line is ended
      resource_id = /^[a-zA-Z_][a-zA-Z0-9\._]*:[^\/]+\/[\S]+$/
      string.match(resource_id) ? on_match : ''
    end
@private
 Detects if the string represents a resourceId
 resourceId is only supported on API >= 18 devices

 @param string [String] the string check for a resourceId
                        value will be auto unquoted
 @param on_match [String] the string to return on resourceId match

 @return [String] empty string on failure, on_match on successful match