w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML videos Categories
Mysql query - couldn't add single quotes within the another single quotes
SET @pid = $memberID = getLoggedId(); $iPid = $GLOBALS['MySQL']->getOne("SELECT `Pid` FROM `Profiles` WHERE `ID` = '$memberID' LIMIT 1"); if($iPid==1){ echo '<div id="id" style="margin:10px 10px 0;" overflow: "hidden;"> <button class="bx-btn bx-btn-img" onclick = "window.open(inviteteacher.php,_self)"> Study with Private Teacher </button> </div>'; }

Categories : PHP

extracting multiple substrings from string using sed
What I would do is to use sed 's/regex to match the old string/new string/' and then write it to a file. so it would be something like this: sed 's/regex to match the old string/new string/' > file and ofcourse to provide sed with input just redirect the standard output of cat: cat thefile.txt | sed ...

Categories : Regex

Extracting substrings from a block of text in C#
you need to do it in one while statement, or you'll never get the error line, and you need to put the sql statement in a different parameter: string RequiredLine2 = "Error Msg"; string RequiredLine1 = "Sql Stmt"; while ((sql_line = SR.ReadLine()) != null) { if (sql_line.Contains(RequiredLine1)) { //crop out string that comes before: int index = sql_line.IndexOf(":") + 1; sql_stmt_line = sql_line.Substring(index); } // error_line = SR.ReadLine(); if (error_line.Contains(RequiredLine2)) { //crop out string that comes before: int index = error_line.IndexOf(":") + 1; error_line = error_line.Substring(index); } } i've also put the RequiredLine2

Categories : C#

Python extracting substrings within brackets in a string
params = sent.split(id1)[1].split(")")[0].lstrip("(") print params That should do what you want. That being said, there are better ways to do this. You could store your items as key:value pairs using a dictionary for example.

Categories : Python

SQL Server Management Studio replacing single quotes with double quotes when modifying stored procedure
I believe you are getting dynamic SQL from the scripting options because you have this option selected: Tools > Options > SQL Server Object Explorer > Scripting > Check for object existence When this setting is enabled, the script is generated like this: IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = ...) BEGIN EXEC dbo.sp_executesql @statement = N'ALTER PROCEDURE...' END Disable this option, and it should be correct when you use right-click > Modify or right-click > Script stored procedure as > ALTER to >.

Categories : Sql Server

Double quotes inside single quotes in oracle statement
I don't think the problem comes from your column name, as shown in this working example: SQL> CREATE TABLE trytable (ID VARCHAR2(10), "DEFAULT" NUMBER); Table created SQL> BEGIN 2 EXECUTE IMMEDIATE 3 'INSERT INTO trytable (ID, "DEFAULT") VALUES (''monkey1'', 0)'; 4 END; 5 / PL/SQL procedure successfully completed Technically, you can have a table column name named DEFAULT, even if it's generally a bad idea that will lead to confusion. You will only be able to interact with it through the double-quote " syntax because DEFAULT is a reserved word. If you specify double quotes around identifiers, Oracle will treat them as case-sensitive, so you have to make sure that they match the table specs. In your case, it would help to have the specific error message.

Categories : Oracle

Single quotes, double quotes and passwords containing $ in Windows and Unix
You can dump from within a pdo PHP script : <?php $dumpSettings = array( 'include-tables' => array('table1', 'table2'), 'exclude-tables' => array('table3', 'table4'), 'compress' => CompressMethod::GZIP, /* CompressMethod::[GZIP, BZIP2, NONE] */ 'no-data' => false, /* http://dev.mysql.com/doc/refman/5.1/en/mysqldump.html#option_mysqldump_no-data */ 'add-drop-table' => false, /* http://dev.mysql.com/doc/refman/5.1/en/mysqldump.html#option_mysqldump_add-drop-table */ 'single-transaction' => true, /* http://dev.mysql.com/doc/refman/5.1/en/mysqldump.html#option_mysqldump_single-transaction */ 'lock-tables' => false, /* http://dev.mysql.com/doc/refman/5.1/en/mysqldump.html#option_mysqldump_lock-tables */ 'add-l

Categories : Windows

Vim: Put newlines around '{' and '}' but not around those inside strings with single quotes or double quotes
One suggestion perhaps, without posting vimscript (though I cannot think of a regex that will do this in one pass) is to decide upon some marker scheme (I prefer 3 hashes) and do it in stages. I will be back later with the correct regex (the commands I'm familiar with are not working so well on my windows gvim install) Step 1: With a regex that searches for anything of the form .*["||'].*{.*}.*["||'] (i.e. braces inside quotes) prepend matching lines with your marker Step 2: Now with a regex search for any lines that match something like: ^[^###]+.*{.*} (i.e. anything with braces and the line not beginning with markers) and put in your returns Step 3: remove the markers

Categories : PHP

Why do I have to escape double quotes in my string surrounded by single quotes?
Looks like you are missing semicolon ; at the end of your variable assignment. It should be: $weapon_secondary = '<select name="weapon" class="dropdown"> <option>Option 1</option> <option>Option 2</option> </select>'; As an alternative you can use heredoc to declare a variable and avoid this quoting exercise: $weapon_secondary <<< EOF <select name="weapon" class="dropdown"> <option>Option 1</option> <option>Option 2</option> </select> EOF;

Categories : PHP

PHP Replace attribute single quotes with double quotes
I realized that PHP's DOMDocument class does this automatically... libxml_use_internal_errors(true); //use this to prevent warning messages from displaying because of the bad HTML $html = new DOMDocument();//'1.0','UTF-8' $html->xmlStandalone = false; $html->loadHTML($b); $b = $html->saveXML();

Categories : PHP

Best Way to escaping single quotes and double quotes in a string
you should use fn:escapeXml() because It escapes quotes and also other characters that could be interpreted as XML markup. . It also helps in prevention of XSS attack in JSP.

Categories : String

php - the single quotes mixture with the double quotes use
Possibly just an error in the question, but this line has 2 semicolons: $query .= "WHERE id='" . $subject_id ."' ";; And if you skip the concatenation, this should work $query .= "WHERE id='$subject_id' "; In PHP, inside double quotes, single quotes are literal and variables are expanded. The other way you wrote it should work too, but it's more code than needed.

Categories : PHP

PHP MySql double quotes than single quotes
double quotes signify that it's a string and the single quotes are part of a string. inside double quotes variables are evaluated so the string will contain the value of the variable 'vValue' not '$v'

Categories : PHP

How do I put single quotes inside of other single quotes?
You can surround them with different quotes in HTML (some of your HTML quotes were unbalanced). In PHP you'll have to escape the inner quotes: echo "<a href="#" onclick="popup('popUpDiv')"><img src='$pic'></a>";

Categories : PHP

Double Quotes in Single Quotes
Escape the quotes in html using &quot; <video id="video1" class="video-js vjs-default-skin" width="640" height="480" data-setup='{ &quot;controls&quot;:true,&quot;autoplay&quot;:false,&quot;preload&quot;: &quot;auto&quot;}'>

Categories : HTML

Regex for identifying and seperate multiple substrings from a single string
You would need to do this with two seperate passes. Each pass would look for the values you're interested in Pass 1: (?<=s|^)(alan)(_)(d+) Pass 2: (?<=s|^)(roma)(_)(d+) However you wanted to know how to do this without the two pass solution. The best you could use an expression which places each match into a separate capture group, but I think this would be more cumbersome: (?<=s|^)(?=alan|roma)(alan)?(roma)?(_)(d+) Live Demo Sample Text How alan_613 are you roma_222 all doing alan_611 Matches In this example note how capture group 1 gets alan, or capture group 2 gets roma [0][0] = alan_613 [0][1] = alan [0][2] = [0][3] = _ [0][4] = 613 [1][0] = roma_222 [1][1] = [1][2] = roma [1][3] = _ [1][4] = 222 [2][0] = alan_611 [2][1] = alan [2][2] = [2][3] = _ [2][4]

Categories : Java

Break strings into substrings based on delimiters, with empty substrings
Now that we've cleared up what the question is about, here's the issue. Your gmatch pattern will return all of the matching substrings in the given string. However, your gmatch pattern uses "+". That means "one or more", which therefore cannot match an empty string. If it encounters a ^ character, it just skips it. But, if you just tried :gmatch("[^^]*"), which allows empty matches, the problem is that it would effectively turn every ^ character into an empty match. Which is not what you want. What you want is to eat the ^ at the end of a substring. But, if you try :gmatch("([^^])^"), you'll find that it won't return the last string. That's because the last string doesn't end with ^, so it isn't a valid match. The closest you can get with gmatch is this pattern: "([^^]*)^?". This has t

Categories : Lua

SQl Output to CSV WITHOUT single Quotes
See doc QUOTE clause The QUOTE clause is for the TEXT output format only. The quote string is placed around string values. The default is a single quote ('). If ALL is specified in the QUOTE clause, the quote string is placed around all values, not just around strings. To suppress quoting, specify empty single quotes. For example, QUOTE ''. So it seems that you should do Output to 'C:SamplePacks.CSV' QUOTE ''

Categories : SQL

Single/double quotes ksh
The "$PWD" resolves immediately. So you're essentially setting PS1 to a fixed value (the value of PWD at the time it's set). When you set to '$PWD', it does not resolve immediately, so it resolves when used, and changes when you change directories. Thus the double quotes are expanding (to a fixed string) as expected, while single quotes are not.

Categories : Unix

PHP implode not working with single quotes?
This means $data has 1 item, because implode works just fine this way. var_dump($data); Please run the dump. Maybe you have wrong delimiter, so $data has one single element.

Categories : PHP

Javascript regex for single, double and no quotes
"width='200', width="200", width=200".replace(/(width=)(?:".*?"|'.*?'|S*)/g, '$1"555"') // => width="555", width="555", width="555" But yeah, this is not a job for regexp.

Categories : Javascript

Excel Escaping Single and double quotes
I find the easiest is to define a variable that contains just the double quote - then use it like any other string. Makes the code much more readable. Example: Dim dq As String, sq as string dq = Chr(34) ' double quote as a variable sq = Chr(39) ' apostrophe or single quote as variable Dim sourceString As String sourceString = "hello" msgbox sq + sourceString + "! " + dq + "you" + dq + sq With these two variables you can create any string you want - after that, replacing what you want with something else (that might contain a crazy sequence of "'"'"'"("!"'") for all I care) becomes trivial. Some helpful rules can be found in this article

Categories : Excel

How can I escape single quotes from get method in Javascript?
You should use php's urldecode on the value. Docs found at http://php.net/manual/en/function.urldecode.php Let me know if that's what you're looking for :)

Categories : PHP

Showing check box label with single quotes
I copied this code: <input type="checkbox" name="<%= contact.contact_value %>" id="<%= contact.contact_value %>" class="custom" /> <label for="<%= contact.contact_value %>"><br/></label> and added it to an existing app view, adding a variable, removing contact. and removing all of the double quotes to make a test: <% contact_value = "'gh'g@ff.bn'" %> <input type="checkbox" name=<%= contact_value %> id=<%= contact_value %> class="custom" /> <label for=<%= contact_value %>><br/><%= contact_value %></label> I get: without any errors. Give it a try without any quotes around the <%= contact.contact_value %> in the view code.

Categories : Ruby

Escaping single quotes for Java MessageFormat
Use the escapeEcmaScript method from Apache Commons Lang package. See Stack Overflow questions: Escaping single quotes for Java MessageFormat How to escape apostrophe or quotes on a JSP (used by JavaScript)

Categories : Java

save XML file with single quotes with JDOM
Technically, yes.... but.... There is nothing semantically different between single and double quotes.... (the resulting document from JDOM is just as valid).... Is there a really good reason why you need to do this? If there is, I would be interested to know, and perhaps introduce it as a 'native' feature of JDOM.... But, you can change the format of it with (only) a little bit of work - 15 lines of code or so... The JDOM2 API in theory makes this a fair amount easier. You can create your own XMLOutputProcessor, using a subclass of the AbstractXMLOutputProcessor and override the printAttribute() method... for example (getting rid of some code paths that your are not likely to need (like non-escaped output): private static final XMLOutputProcessor CUSTOMATTRIBUTEQUOTES = new AbstractXMLO

Categories : Java

how to force jquery attr() to add the attribute with single quotes
Replace the double quotes with HTML entities: var value = '{"video1":"http://www.youtube.com/watch?v=KdxEAt91D7k&list=TLhaPoOja-0f4","video2":"http://www.youtube.com/watch?v=dVlaZfLlWQc&list=TLalXwg9bTOmo"}'; # Naive approach: value = value.replace('&', '&amp;').replace('"', '&quot;'); # Using jQuery: var $tmp = jQuery('<div></div>'); value = $tmp.text(value).html(); // Then store it as normal

Categories : Javascript

jquery function works after single space in quotes
First question The jQuery's argument is a CSS selector. The space means that you are selecting a child of div:not([id=header]); "div:not([id=header]) div#foo" is not the same as "div:not([id=header])div#foo" Second question: The "hierarchy" of quotes doesn't matter, "text'foo'dd" is OK, just as 'text"foo"dd'. It's up to your taste, but usually using single quotes outside is more practical, since you can have the double ones, used most of the time, in the string.

Categories : Javascript

Is it necessary to explicitly specify single quotes in a DML statement that uses String.Format()?
If all of the values are of numerical types such as int, decimal, bigint, etc. then you don't need to enclose them in single quotes. This code works (I just tested it) dSQL = string.Format( "INSERT INTO inventory ( id, pksize, Description, supplier_id, UnitCost, UnitList," + " Qty, UPC, dept, subdept, upc_pack_size, supplier_item, bqu_id)" + " VALUES ({0}, {1}, {2}, {3}, {4}, {5}, {6}, {7}, {8}, {9}, {10}, {11}, {12})", id, pksize, desc, supplierID, cost, list, qty, UPC, dept, subdept, UPCpkSize, supplierItem, redemption); You were missing the starting and closing braces in your code.

Categories : C#

PHP to output single and double quotes as a value for an input element
Try using htmlspecialchars. This will escape the " in yout title. value="'.htmlspecialchars($title).'">

Categories : PHP

Submitting NULL to database - single quotes issue?
You should set your table default to null, but to actually fix this you'll have to switch your quotes around, pHP evaluates any var between " and not so now it set an empty value and not literally null. THe best solution is this though if(empty($post['gallery']))$post['gallery'] = "NULL"; then it actually puts in the NULL value mysql needs

Categories : PHP

Rails email double escaping single quotes
Turns out it was a change one of the other developers had made. They'd added sanitisation to the input so it was being escaped before being stored, and then rails was escaping it when displaying so it was being double escaped. Sorted now :)

Categories : Ruby On Rails

Single and double quotes in textfield, how to make them visible?
printf('<input type="text" name="1" id="1" value="%s">', htmlspecialchars($string)); HTML escape the data. All data you're outputting into HTML, in fact. See The Great Escapism (Or: What You Need To Know To Work With Text Within Text).

Categories : PHP

Heredocs, variables and single quotes in BASH and MySQL
Scrap that. My fault - missed the first field in the database. The single quotes work as they should with heredocs.. (i.e. '$VARIABLE' prints 'myvariable' just like $VARIABLE prints myvariable).

Categories : Mysql

Removing single quotes from comparison in select statement
Take a look at: http://www.artfulsoftware.com/infotree/queries.php#552 This will give you the distance between two strings. I.e. you can check whether levensthein distance is less than 3, which means, less than 3 operations are required to be equal.

Categories : Mysql

append values with both single and double quotes to textbox
This is because you are concatenating strings, which doesn't take escaping of special characters into account. You should instead set the value with .val so that the value is escaped properly. Also, the regex is unnecessary. $(document).ready(function(){ var test= "this is vicky"s "s 's 's "s "S"; alert(test); var input = $("<input style='width:700px;' id='testbox'></input>").val(test); $("#test").html("hey this is ").append(input); }); See updated test case on jsFiddle

Categories : Javascript

Single-Double quotes error in Full Text Search
You have an extra embedded double quote: CONTAINS(PositionDesired,'"*"JAVA*"') ----------------------------^ This effectively terminates the string early, and SQL Server doesn't understand what that extra stuff is. Should be (I think, not a full-text guru): CONTAINS(PositionDesired,'"*JAVA*"') However, I think that will eliminate the error, but not return the results you are after, since punctuation is ignored. You may have to use a combination of CONTAINS and LIKE, e.g.: CONTAINS(PositionDesired,'JAVA') AND PositionDesired LIKE '%"JAVA"%' Or for the new requirement you've added: CONTAINS(PositionDesired,'JAVA PHP') AND PositionDesired LIKE '%"JAVA"PHP%"' In the LIKE clause you don't have to worry about escaping or doubling-up the double quote, because it isn't a string

Categories : Sql Server

Replacing the single quotes for columns in select statement in SQL Server
You will need to use dynamic SQL to achieve this, for example: CREATE TABLE Table1 ( ID INT ,Name VARCHAR(255) ,ADDRESS VARCHAR(255) ) INSERT Table1 VALUES ('1','Joe Bloggs','Address 1') INSERT Table1 VALUES ('2','Jane Doe','Address 2') DECLARE @ColName VARCHAR(255) = 'ID' DECLARE @SQL VARCHAR(MAX) SET @SQL = 'SELECT '+@ColName+','+''''+@ColName+''' FROM TABLE1' EXEC (@SQL) In the first column that is returned, is the SQL you want to be able to execute, however in the 2nd column in my query, is what you're doing at the moment. As far as SQL is concerned, your variable is simply storing a value. It does not know you are referring to a column name which is why it simply returns the value.

Categories : Sql Server

Bash: String variable that includes literal single quotes
Passing the password via command line is considered insecure as other users could see the password in plain text either using ps afx or the /proc file system. I've recently wrote a blog post regarding this topic. However, to make the command just working it needs double quotes " around $MYPASS to prevent bash from interpreting the space-sepearated password as multiple args: MYPASS="foo bar password" mysql -u backupuser -p"$MYPASS" -e ... But I would highly recommend a solution like the following, which uses expect to pass the password to mysqldump: #!/bin/bash # mysql credentials and connection data db_host="localhost" db_name="testdb" db_user="jon" db_pass="secret" # I'm using a here-document to pass commands to expect. # (the commands could be stored in a file as well) expect &l

Categories : Bash

Javascript regex, getting error when removing all single quotes except for those that precede an s
(?<![a-z]) is the problem, because lookbehind doesn't exist in javascript. If you want make some test for regex in javascript, use an online tool for javascript like regexpal. I don't know what you are trying to do but you can try this code: return str.replace(/%2[37]|(^|[^a-z])'|'(?!s)|--|#/gi, "$1-restricted-"); I have replaced the negative lookbehind (?<![a-z]) (ie: not preceded by a letter) by a capturing group (^|[^a-z]) (ie: begining of the string OR a character that is not a letter). Since it is not a simple check like a lookaround but a match, the replace will delete this "non-letter", then I put a reference in the replacement pattern to this first capturing group ($1) to replace it by itself.

Categories : Javascript



© Copyright 2017 w3hello.com Publishing Limited. All rights reserved.