Search Results

Search found 4929 results on 198 pages for 'character'.

Page 116/198 | < Previous Page | 112 113 114 115 116 117 118 119 120 121 122 123  | Next Page >

  • Find all possible starting positions of a regular expression match in perl, including overlapping matches?

    - by jonderry
    Is there a way to find all possible start positions for a regex match in perl? For example, if your regex was "aa" and the text was "aaaa", it would return 0, 1, and 2, instead of, say 0 and 2. Obviously, you could just do something like return the first match, and then delete all characters up to and including that starting character, and perform another search, but I'm hoping for something more efficient.

    Read the article

  • Why does visual studio think js file is a cs file?

    - by divitiae
    I have a ASP.NET solution in Visual Studio 2008 and I added a file identical to http://plugins.jquery.com/files/jquery.cookie.js.txt named jquery.cookie.js in a subfolder of my project containing other javascript files and Visual Studio is treating it as a C# file, giving me errors like CS1012: Too many characters in character literal and Semicolon after method or accesssor block is not valid. Why?

    Read the article

  • Is the Google Annotations Gallery useful in production code?

    - by cafe
    I could actually see a use for the Google Annotations Gallery in real code: Stumble across code that somehow works beyond all reason? Life's short. Mark it with @Magic and move on: @Magic public static int negate(int n) { return new Byte((byte) 0xFF).hashCode() / (int) (short) '\uFFFF' * ~0 * Character.digit ('0', 0) * n * (Integer.MAX_VALUE * 2 + 1) / (Byte.MIN_VALUE >> 7) * (~1 | 1); } This is a serious question. Could this be used in an actual code review?

    Read the article

  • Testing stored procedures

    - by giri
    Hi , How to test procedures with record type parameters.I have a procedure which takes test_ap ,basic and user_name as inputs.where test_ap is of record/row type,basic record array type and user_name charater varying. I need to test the procedure in pgadmin. test_client(test_ap test_base, basic test_base_detail[], user_name character varying) Any suggestions plz.

    Read the article

  • Java: Converting UTF 8 to String

    - by kujawk
    When I run the following program: public static void main(String args[]) throws Exception { byte str[] = {(byte)0xEC, (byte)0x96, (byte)0xB4}; String s = new String(str, "UTF-8"); } on Linux and inspect the value of s in jdb, I correctly get: s = "ì–´" on Windows, I incorrectly get: s = "?" My byte sequence is a valid UTF-8 character in Korean, why would it be producing two very different results?

    Read the article

  • How to get all captures of subgroup matches with preg_match_all()?

    - by hakre
    Update/Note: I think what I'm probably looking for is to get the captures of a group in PHP. Referenced: PCRE regular expressions using named pattern subroutines. (Read carefully:) I have a string that contains a variable number of segments (simplified): $subject = 'AA BB DD '; // could be 'AA BB DD CC EE ' as well I would like now to match the segments and return them via the matches array: $pattern = '/^(([a-z]+) )+$/i'; $result = preg_match_all($pattern, $subject, $matches); This will only return the last match for the capture group 2: DD. Is there a way that I can retrieve all subpattern captures (AA, BB, DD) with one regex execution? Isn't preg_match_all suitable for this? This question is a generalization. Both the $subject and $pattern are simplified. Naturally with such the general list of AA, BB, .. is much more easy to extract with other functions (e.g. explode) or with a variation of the $pattern. But I'm specifically asking how to return all of the subgroup matches with the preg_...-family of functions. For a real life case imagine you have multiple (nested) level of a variant amount of subpattern matches. Example This is an example in pseudo code to describe a bit of the background. Imagine the following: Regular definitions of tokens: CHARS := [a-z]+ PUNCT := [.,!?] WS := [ ] $subject get's tokenized based on these. The tokenization is stored inside an array of tokens (type, offset, ...). That array is then transformed into a string, containing one character per token: CHARS -> "c" PUNCT -> "p" WS -> "s" So that it's now possible to run regular expressions based on tokens (and not character classes etc.) on the token stream string index. E.g. regex: (cs)?cp to express one or more group of chars followed by a punctuation. As I now can express self-defined tokens as regex, the next step was to build the grammar. This is only an example, this is sort of ABNF style: words = word | (word space)+ word word = CHARS+ space = WS punctuation = PUNCT If I now compile the grammar for words into a (token) regex I would like to have naturally all subgroup matches of each word. words = (CHARS+) | ( (CHARS+) WS )+ (CHARS+) # words resolved to tokens words = (c+)|((c+)s)+c+ # words resolved to regex I could code until this point. Then I ran into the problem that the sub-group matches did only contain their last match. So I have the option to either create an automata for the grammar on my own (which I would like to prevent to keep the grammar expressions generic) or to somewhat make preg_match working for me somehow so I can spare that. That's basically all. Probably now it's understandable why I simplified the question. Related: pcrepattern man page Get repeated matches with preg_match_all()

    Read the article

  • Converting upper-case string into title-case using Ruby

    - by wsb3383
    Hi, all. I'm trying to convert an all-uppercase string in Ruby into a lower case one, but with each word's first character being upper case. Example: convert "MY STRING HERE" to "My String Here". I know I can use the .downcase method, but that would make everything lower case ("my string here"). I'm scanning all lines in a file and doing this change, so is there a regular expression I can use through ruby to achieve this? Thanks!

    Read the article

  • php won't detect all spaces in a string...

    - by user296516
    Hi guys, I've got a string that comes from a POST form where I want to replace all spaced with some other character. Here's that I did: $cdata = str_replace(" ","#",$cdata); And I got this. --- Contact-ID#=#148 [10274da8]#Sinhronizacija#=#private [1000137d]#Uzvards#=#Zom [1000137c]#Vards#=#Tana [1000130e]#Talrunis#=#3333 [1000130e]#Mobilais#=#5555 As you can see, spaced before "[10..." are still there. Any ideas what could be the problem?

    Read the article

  • Remove duplicate characters and keep the uniq ones

    - by manu
    How do I remove duplicate characters and keep the uniq one only. Ex. My input is EFUAHUU UUUEUUUUH UJUJHHACDEFUCU Expected output is EFUAH UEH UJHACDEF I cam across perl -pe's/$1//gwhile/(.).*\/' which is wonderful but it is removing even the single occurence of the character in output. Can anyone help. Thanks in advance Manjeet

    Read the article

  • Reading doc file using streamreader

    - by Bishal
    I am trying to read .doc/.docx file with stream reader, but it give me output as unspecified character ie. ??[ ?L?f???C???. I'm writing the file using a text editor. Here's a snippet of my code: string filePath = baseUrl+ "Sample.docx"; using (StreamReader reader = new StreamReader(filePath, Encoding.UTF8)) { txtBody.Text = reader.ReadToEnd(); } I'm using VS 2010. Thank you.

    Read the article

  • Java compile error: reached end of file while parsing } [closed]

    - by adeo8
    I have the following source code public class mod_MyMod extends BaseMod public String Version() { return "1.2_02"; } public void AddRecipes(CraftingManager recipes) { recipes.addRecipe(new ItemStack(Item.diamond), new Object[] { "#", Character.valueOf('#'), Block.dirt }); } When I try to compile it I get the following error: java:11: reached end of file while parsing } What am I doing wrong? Any help appreciated.

    Read the article

  • delete common dictionaries in list based on a value

    - by pythoonatic
    How would I delete all corresponding dictionaries in a list of dictionaries based on one of the dictionaries having a character in it. data = [ { 'x' : 'a', 'y' : '1' }, { 'x' : 'a', 'y' : '1/1' }, { 'x' : 'a', 'y' : '2' }, { 'x' : 'b', 'y' : '1' }, { 'x' : 'b', 'y' : '1' }, { 'x' : 'b', 'y' : '1' }, ] For example, how would I delete all of the x = a due to one of the y in the x=a having a / in it? Based on the example data above, here is where I would like to get to: cleaneddata = [ { 'x' : 'b', 'y' : '1' }, { 'x' : 'b', 'y' : '1' }, { 'x' : 'b', 'y' : '1' }, ]

    Read the article

  • SQL 2008 CASE statement aggravation...

    - by Brad
    Why does this fail: DECLARE @DATE VARCHAR(50) = 'dasf' SELECT CASE WHEN ISDATE(@DATE) = 1 THEN CONVERT(date,@DATE) ELSE @DATE END Msg 241, Level 16, State 1, Line 2 Conversion failed when converting date and/or time from character string. Why is it trying to convert dasf to date when it clearly causes ISDATE(@DATE) = 1 to evaluate to false... If I do: SELECT ISDATE(@DATE) The return value is 0.

    Read the article

  • reading a file word by word

    - by nalbina
    I can read from a file 1 character at a time, but how do i make it go just one word at a time? So, read until there is a space and take that as a string. This gets me the characters: while (!fin.eof()){ while (fin f ){ F.push_back ( f ); }

    Read the article

  • Need Help in PHP Regex

    - by amateurs
    I am studying about regex, i figured out some about matching one or more character, but i have a case, but don't know how to solve this.. For example i have: $data = "bla bla -start- blu blu blu -end- bla bla"; $pattern = "/\-start\-[\w]\-end\- /"; preg_match($pattern, $data, $matches); print_r($matches); i intend to take anything between '-start-' and '-end-', so i expect to get ' blu blu blu '. any suggestion ?

    Read the article

  • How to Concatenate 2 C strings, without overwriting any terminating Null characters?

    - by Ben313
    Hello, I am trying to set up a list of file names for a parameter to SHFileOperation. I want to be able to concatenate a file name onto the char array, but i dont want to get rid of the terminating character. for example, I want this: C:\...\0E:\...\0F:\...\0\0 when i use strcat(), it overwrites the null, so it looks like C:\...E:\...F:\...0\ Is there any easy way to do this? or am i going to have to code a new strcat for myself?

    Read the article

< Previous Page | 112 113 114 115 116 117 118 119 120 121 122 123  | Next Page >