hyphen

Can hyphens be used in query string values?

拈花ヽ惹草 提交于 2019-12-04 02:17:51
My question is related to this one . except that my question is more sepcific as it is about whether a hyphen can be used in a query string parameter value. I am parsing $_SERVER['QUERY_STRING'] with PHP. I would like to know whether it is syntactically correct to use hyphens in query string values such as in the following case, or whether hyphens must be escaped in the browser URL. What about underscores? http://example.com/?q1=query-string-value-one&q2=query-string-value-two According to this document hyphens should be OK in all standards-compliant browsers, but I wanted to double check.

Challenge with hyphens/dashes in Solr Lucene

有些话、适合烂在心里 提交于 2019-12-02 06:44:00
问题 I'm trying to cause Solr to extract only the second 7 digit portion of a ticket formatted like n-nnnnnnn Originally I hoped to keep the full ticket together. According to documentation digits with numbers should be kept together but after hammering away a this problem for some time and looking at the code I don't think that's the case. Solr always generates two terms. So rather than large numbers of matches for the first digit of n- I'm thinking I can get better query results from just the

Matching text between hyphens with regex

非 Y 不嫁゛ 提交于 2019-12-01 17:38:24
问题 Currently I have this string "RED-CURRENT_FORD-something.something" I need to capture the word between the hypens. In this case the word CURRENT_FORD I have the following written \CURRENT_.*\B-\ Which returns CURRENT_FORD- which is wrong on two levels. It implies that everything between hyphens starts with CURRENT It includes the hyphen at the end. Any more efficient way of capturing the words in between the hyphens without explicitly stating the first word? 回答1: You can use the delimiters to

Lua string.gsub with a hyphen

此生再无相见时 提交于 2019-11-30 08:37:39
问题 I have two strings - each string has many lines like the following: value_1 = "DEFAULT-VLAN" value_2 = "WAN" data = "HOSTNAME = DEFAULT-VLAN" result = string.gsub(data,value_1,value_2) print(result) Result: data = "HOSTNAME = DEFAULT-VLAN" When the hyphen ("-") is deleted from the value it is working. Is there an easy way to solve this? Thanks! 回答1: - is a magic character in Lua patterns. You need to escape it. Change value_1 = "DEFAULT-VLAN" to: value_1 = "DEFAULT%-VLAN" 回答2: This is because

Lua string.gsub with a hyphen

做~自己de王妃 提交于 2019-11-29 07:16:14
I have two strings - each string has many lines like the following: value_1 = "DEFAULT-VLAN" value_2 = "WAN" data = "HOSTNAME = DEFAULT-VLAN" result = string.gsub(data,value_1,value_2) print(result) Result: data = "HOSTNAME = DEFAULT-VLAN" When the hyphen ("-") is deleted from the value it is working. Is there an easy way to solve this? Thanks! - is a magic character in Lua patterns. You need to escape it. Change value_1 = "DEFAULT-VLAN" to: value_1 = "DEFAULT%-VLAN" This is because string.gsub takes a pattern similar to Regex—it does not do a "literal" replacement; this means you need to

How to allow fulltext searching with hyphens in the search query

不打扰是莪最后的温柔 提交于 2019-11-29 03:53:27
I have keywords like "some-or-other" where the hyphens matter in the search through my mysql database. I'm currently using the fulltext function. Is there a way to escape the hyphen character? I know that one option is to comment out #define HYPHEN_IS_DELIM in the myisam/ftdefs.h file, but unfortunately my host does not allow this. Is there another option out there? Edit 3-8-11 Here's the code I have right now: $search_input = $_GET['search_input']; $keyword_safe = mysql_real_escape_string($search_input); $keyword_safe_fix = "*'\"" . $keyword_safe . "\"'*"; $sql = " SELECT *, MATCH(coln1,

SQL Sorting and hyphens

时间秒杀一切 提交于 2019-11-27 09:18:01
Is there a way to easily sort in SQL Server 2005 while ignoring hyphens in a string field? Currently I have to do a REPLACE(fieldname,'-','') or a function to remove the hyphen in the sort clause. I was hoping there was a flag I could set at the top of the stored procedure or something. Access and the GridView default sorting seems to ignore the hypen in strings. I learned something new, just like you as well I believe the difference is between a " String Sort " vs a " Word Sort " (ignores hyphen) Sample difference between WORD sort and STRING sort http://andrusdevelopment.blogspot.com/2007/10

How to import module when module name has a '-' dash or hyphen in it?

隐身守侯 提交于 2019-11-27 03:12:52
I want to import foo-bar.py. This works: foobar = __import__("foo-bar") This does not: from "foo-bar" import * My question: Is there any way that I can use the above format i.e., from "foo-bar" import * to import a module that has a - in it? you can't. foo-bar is not an identifier. rename the file to foo_bar.py Edit: If import is not your goal (as in: you don't care what happens with sys.modules , you don't need it to import itself), just getting all of the file's globals into your own scope, you can use execfile # contents of foo-bar.py baz = 'quux' >>> execfile('foo-bar.py') >>> baz 'quux' >

Hyphens in column names in MySQL DB

孤人 提交于 2019-11-27 02:08:01
May be this question has been answered before but I couldn't find it. I am using a 2/3 yr old MySQL database which has hyphens in its column names. When I try to use these names from my Java code, the names are broken at the hyphen (e.g. air_port becomes air) and thus are not found. I tried replacing hyphens to underscores in my code hoping that the DB might treat them equally but that doesn't work. How can I escape the hyphen or how can I access these columns ? Could this be an issue of the character set being used ? enclose the names within `back-ticks` Do you have hyphens (-) or underscores

SQL Sorting and hyphens

一世执手 提交于 2019-11-26 14:37:28
问题 Is there a way to easily sort in SQL Server 2005 while ignoring hyphens in a string field? Currently I have to do a REPLACE(fieldname,'-','') or a function to remove the hyphen in the sort clause. I was hoping there was a flag I could set at the top of the stored procedure or something. Access and the GridView default sorting seems to ignore the hypen in strings. 回答1: I learned something new, just like you as well I believe the difference is between a " String Sort " vs a " Word Sort "