Searching for numbers in a string

I am trying to filter passwords stored in a string variable and ensure that they contain at least a number and one capital letter.
how do you search for numbers in a string and search if that string contains a character in uppercase?

function checkString(username){
var userfield = username;
var valid = '0123456789ABCDEFGHIJKLMN�OPQRSTUVWXYZ'; // define valid characters
if(!isValid(userfield.value,valid)){
alert("Invalid user name format");
userfield.value="";
userfield.select();
     userfield.focus();
}else{
err = 0;
userfield = userfield.value;
function isValid(string,allowed) {
for (var i=0; i< string.length; i++) {
if (allowed.indexOf(string.charAt(i)) == -1)
return false;
return true;
}

Similar Messages

  • Tell me Logic for search for duplicate words(or strings) in a large file.

    Search for duplicate words (or strings) in a text file containing one word per line. For each word that occurs more than once in the flat file output should be as follows
    <word> <number of occurrences> <line numbers in the file where the word occurs>
    For example, if the word Hello occurs thrice in a file at lines 100, 178 and 3456 the output should read
    Hello, 3, [100, 178, 3456]

    Incidentally i wrote similar code some days back. You need to do some modifications to get the exact output you want, but i hope it will be of some help.
    One more thing its written using JAVA5
    public class Test
         private static final String COLLECTIONS_TEXT = "C:\\Documents and Settings\\amrainder\\Desktop\\Collections.txt";
         public static void main(String[] args) throws IOException
              findDuplicateWords();
         private static void findDuplicateWords() throws IOException
              Collection<String> words = new LinkedHashSet<String>();
              File file = new File(COLLECTIONS_TEXT);
              StreamTokenizer streamTokenizer = new StreamTokenizer(new FileReader(file));
              int token = streamTokenizer.nextToken();
              while(token != StreamTokenizer.TT_EOF)
                   if(token == StreamTokenizer.TT_WORD)
                        words.add(streamTokenizer.sval);
                   token = streamTokenizer.nextToken();
              System.out.println(words);
    }Cheers,
    Amrainder

  • Searching for Numbers in Pdf

    Hi, Is there a shortcut to search for numbers in a pdf file

    Not sure what you mean.
    You have the find feature (ctrl + f) or the advanced search feature (ctrl+shift+f) to search for digits, words, strings etc.

  • How to search for words in a string?

    I have a list of strings that I need to search for instances
    of a certain word (or part of that word) is there a way of doing
    this in flash please?

    Quickest and easiest way to do it is to search through an
    array of manually entered words.

  • How to Search for "(" error  in a string?

    I am trying to search for "(" in a string, however the compiler thinks that I searching for a regular expression, and fails.
    Exception in thread "main" java.util.regex.PatternSyntaxException: Unclosed group near index 1
    Please help me find a way to search for "(" in a string.
    Example:
    String test="This is a test.";
    if (test.matches("(")){
    System.out.println("There is a match")
    I also tried:
    test.matches("\050")
    and test.matches("\(")
    Thank you!

    I also tried:
    test.matches("\050")
    and test.matches("\(")For this particular problem, I think indexOf is a more appropriate solution. However, for future reference, I think what you want to do for parentheses is escape the backslash, not the bracket.
    i.e.
    test.matches("\\(");

  • Search for White space within strings

    create table emp_dtl
    (empname varchar2(23));
    Insert into emp_dtl values ('WAYNE');
    Insert into emp_dtl values ('JOSEPH KRUPP');     --------- has white space
    Insert into emp_dtl values ('YING ZONG LEE');    --------- has white space
    Insert into emp_dtl values ('COHEN');
    Insert into emp_dtl values ('MARIE');How can i search for empnames which has White space in it? From other OTN threads, I gathered that this has something to do with
    chr(32)But i don't know how to put this in LIKE operator.

    Hi,
    SELECT  *
    FROM    emp_dtl
    WHERE   REGEXP_LIKE (empname, '\s')
    ;will look for any kind of whitespace (including spaces, which are CHR (32)).
    It may be more efficient to specifically list all the different whitespace characters, and see if the string changes when you remove all of them:
    SELECT     *
    FROM     emp_dtl
    WHERE     empname != TRANSLATE ( empname
                           , 'x ' || CHR (9)     -- CHR (9)  = <tab>
                                          || CHR (10)     -- CHR (10) = <newline>
                                 || CHR (13)     -- CHR (13) = <return>
                           , 'x'
    ;Edited by: Frank Kulash on Jul 12, 2010 8:47 AM

  • Correct way to search for character within a string

    I am trying to search for the occurrence of a "(" within a text string - unfortunately my code is reported as incorrect.
    I extract the text correctly but cannot create the search statement correctly:
    var mylistpgftext = pgf.GetText (Constants.FTI_String)   
    for (var i=0; i < mylistpgftext.length; i++)             
        var mylistitem = mylistpgftext[i].sdata              
        var mybracketpos = mylistitem.search(/(/i)    --------------error line-----------------       
        if (mybracketpos != -1)                              
          alert(mylistitem)                                  

    Hi Bob, I did not test this, but I think the problem is an unescaped character in your regular expression. Try this.
    var mybracketpos = mylistitem.search(/\(/i);
    Notice the backslash before the open parens that you are searching for.
    -Rick

  • Searching for numbers

    Hi!
    I'm having a problem when I search numbers in a text.
    For example I need to find texts that contains 10.060 (with point) and texts that contains 10060 (without point).
    Can you help me?
    Thanks! Regards,

    Thanks! This is the output from the sentence you sent me.
    I hope you find a difference!!!
    Regards,
    Fabiana.
    begin
    ctx_ddl.create_preference('"MYINDEX_DST"','DIRECT_DATASTORE');
    end;
    begin
    ctx_ddl.create_preference('"MYINDEX_FIL"','NULL_FILTER');
    end;
    begin
    ctx_ddl.create_section_group('"MYINDEX_SGP"','NULL_SECTION_GROUP');
    end;
    begin
    ctx_ddl.create_preference('"MYINDEX_LEX"','BASIC_LEXER');
    ctx_ddl.set_attribute('"MYINDEX_LEX"','SKIPJOINS','.');
    ctx_ddl.set_attribute('"MYINDEX_LEX"','NUMJOIN',',');
    end;
    begin
    ctx_ddl.create_preference('"MYINDEX_WDL"','BASIC_WORDLIST');
    ctx_ddl.set_attribute('"MYINDEX_WDL"','STEMMER','SPANISH');
    ctx_ddl.set_attribute('"MYINDEX_WDL"','FUZZY_MATCH','SPANISH');
    end;
    begin
    ctx_ddl.create_stoplist('"MYINDEX_SPL"','BASIC_STOPLIST');
    ctx_ddl.add_stopword('"MYINDEX_SPL"','Sr');
    ctx_ddl.add_stopword('"MYINDEX_SPL"','Sra');
    ctx_ddl.add_stopword('"MYINDEX_SPL"','Sres');
    ctx_ddl.add_stopword('"MYINDEX_SPL"','Sta');
    ctx_ddl.add_stopword('"MYINDEX_SPL"','a');
    ctx_ddl.add_stopword('"MYINDEX_SPL"','acá');
    ctx_ddl.add_stopword('"MYINDEX_SPL"','ahí');
    ctx_ddl.add_stopword('"MYINDEX_SPL"','ajena');
    ctx_ddl.add_stopword('"MYINDEX_SPL"','ajenas');
    ctx_ddl.add_stopword('"MYINDEX_SPL"','ajeno');
    ctx_ddl.add_stopword('"MYINDEX_SPL"','ajenos');
    ctx_ddl.add_stopword('"MYINDEX_SPL"','al');
    ctx_ddl.add_stopword('"MYINDEX_SPL"','algo');
    ctx_ddl.add_stopword('"MYINDEX_SPL"','alguna');
    ctx_ddl.add_stopword('"MYINDEX_SPL"','algunas');
    ctx_ddl.add_stopword('"MYINDEX_SPL"','alguno');
    ctx_ddl.add_stopword('"MYINDEX_SPL"','algunos');
    ctx_ddl.add_stopword('"MYINDEX_SPL"','algún');
    ctx_ddl.add_stopword('"MYINDEX_SPL"','allá');
    ctx_ddl.add_stopword('"MYINDEX_SPL"','allí');
    ctx_ddl.add_stopword('"MYINDEX_SPL"','aquel');
    ctx_ddl.add_stopword('"MYINDEX_SPL"','aquella');
    ctx_ddl.add_stopword('"MYINDEX_SPL"','aquellas');
    ctx_ddl.add_stopword('"MYINDEX_SPL"','aquello');
    ctx_ddl.add_stopword('"MYINDEX_SPL"','aquellos');
    ctx_ddl.add_stopword('"MYINDEX_SPL"','aquí');
    ctx_ddl.add_stopword('"MYINDEX_SPL"','cada');
    ctx_ddl.add_stopword('"MYINDEX_SPL"','cierta');
    ctx_ddl.add_stopword('"MYINDEX_SPL"','ciertas');
    ctx_ddl.add_stopword('"MYINDEX_SPL"','cierto');
    ctx_ddl.add_stopword('"MYINDEX_SPL"','ciertos');
    ctx_ddl.add_stopword('"MYINDEX_SPL"','como');
    ctx_ddl.add_stopword('"MYINDEX_SPL"','con');
    ctx_ddl.add_stopword('"MYINDEX_SPL"','conmigo');
    ctx_ddl.add_stopword('"MYINDEX_SPL"','consigo');
    ctx_ddl.add_stopword('"MYINDEX_SPL"','contigo');
    ctx_ddl.add_stopword('"MYINDEX_SPL"','cualquier');
    ctx_ddl.add_stopword('"MYINDEX_SPL"','cualquiera');
    ctx_ddl.add_stopword('"MYINDEX_SPL"','cualquieras');
    ctx_ddl.add_stopword('"MYINDEX_SPL"','cuan');
    ctx_ddl.add_stopword('"MYINDEX_SPL"','cuanta');
    ctx_ddl.add_stopword('"MYINDEX_SPL"','cuantas');
    ctx_ddl.add_stopword('"MYINDEX_SPL"','cuanto');
    ctx_ddl.add_stopword('"MYINDEX_SPL"','cuantos');
    ctx_ddl.add_stopword('"MYINDEX_SPL"','cuán');
    ctx_ddl.add_stopword('"MYINDEX_SPL"','cuánta');
    ctx_ddl.add_stopword('"MYINDEX_SPL"','cuántas');
    ctx_ddl.add_stopword('"MYINDEX_SPL"','cuánto');
    ctx_ddl.add_stopword('"MYINDEX_SPL"','cuántos');
    ctx_ddl.add_stopword('"MYINDEX_SPL"','cómo');
    ctx_ddl.add_stopword('"MYINDEX_SPL"','de');
    ctx_ddl.add_stopword('"MYINDEX_SPL"','dejar');
    ctx_ddl.add_stopword('"MYINDEX_SPL"','del');
    ctx_ddl.add_stopword('"MYINDEX_SPL"','demasiada');
    ctx_ddl.add_stopword('"MYINDEX_SPL"','demasiadas');
    ctx_ddl.add_stopword('"MYINDEX_SPL"','demasiado');
    ctx_ddl.add_stopword('"MYINDEX_SPL"','demasiados');
    ctx_ddl.add_stopword('"MYINDEX_SPL"','demás');
    ctx_ddl.add_stopword('"MYINDEX_SPL"','el');
    ctx_ddl.add_stopword('"MYINDEX_SPL"','ella');
    ctx_ddl.add_stopword('"MYINDEX_SPL"','ellas');
    ctx_ddl.add_stopword('"MYINDEX_SPL"','ellos');
    ctx_ddl.add_stopword('"MYINDEX_SPL"','esa');
    ctx_ddl.add_stopword('"MYINDEX_SPL"','esas');
    ctx_ddl.add_stopword('"MYINDEX_SPL"','ese');
    ctx_ddl.add_stopword('"MYINDEX_SPL"','esos');
    ctx_ddl.add_stopword('"MYINDEX_SPL"','esta');
    ctx_ddl.add_stopword('"MYINDEX_SPL"','estar');
    ctx_ddl.add_stopword('"MYINDEX_SPL"','estas');
    ctx_ddl.add_stopword('"MYINDEX_SPL"','este');
    ctx_ddl.add_stopword('"MYINDEX_SPL"','estos');
    ctx_ddl.add_stopword('"MYINDEX_SPL"','hacer');
    ctx_ddl.add_stopword('"MYINDEX_SPL"','hasta');
    ctx_ddl.add_stopword('"MYINDEX_SPL"','jamás');
    ctx_ddl.add_stopword('"MYINDEX_SPL"','junto');
    ctx_ddl.add_stopword('"MYINDEX_SPL"','juntos');
    ctx_ddl.add_stopword('"MYINDEX_SPL"','la');
    ctx_ddl.add_stopword('"MYINDEX_SPL"','las');
    ctx_ddl.add_stopword('"MYINDEX_SPL"','lo');
    ctx_ddl.add_stopword('"MYINDEX_SPL"','los');
    ctx_ddl.add_stopword('"MYINDEX_SPL"','mas');
    ctx_ddl.add_stopword('"MYINDEX_SPL"','me');
    ctx_ddl.add_stopword('"MYINDEX_SPL"','menos');
    ctx_ddl.add_stopword('"MYINDEX_SPL"','mientras');
    ctx_ddl.add_stopword('"MYINDEX_SPL"','misma');
    ctx_ddl.add_stopword('"MYINDEX_SPL"','mismas');
    ctx_ddl.add_stopword('"MYINDEX_SPL"','mismo');
    ctx_ddl.add_stopword('"MYINDEX_SPL"','mismos');
    ctx_ddl.add_stopword('"MYINDEX_SPL"','mucha');
    ctx_ddl.add_stopword('"MYINDEX_SPL"','muchas');
    ctx_ddl.add_stopword('"MYINDEX_SPL"','mucho');
    ctx_ddl.add_stopword('"MYINDEX_SPL"','muchos');
    ctx_ddl.add_stopword('"MYINDEX_SPL"','muchísima');
    ctx_ddl.add_stopword('"MYINDEX_SPL"','muchísimas');
    ctx_ddl.add_stopword('"MYINDEX_SPL"','muchísimo');
    ctx_ddl.add_stopword('"MYINDEX_SPL"','muchísimos');
    ctx_ddl.add_stopword('"MYINDEX_SPL"','muy');
    ctx_ddl.add_stopword('"MYINDEX_SPL"','más');
    ctx_ddl.add_stopword('"MYINDEX_SPL"','mía');
    ctx_ddl.add_stopword('"MYINDEX_SPL"','mío');
    ctx_ddl.add_stopword('"MYINDEX_SPL"','nada');
    ctx_ddl.add_stopword('"MYINDEX_SPL"','ni');
    ctx_ddl.add_stopword('"MYINDEX_SPL"','ninguna');
    ctx_ddl.add_stopword('"MYINDEX_SPL"','ningunas');
    ctx_ddl.add_stopword('"MYINDEX_SPL"','ninguno');
    ctx_ddl.add_stopword('"MYINDEX_SPL"','ningunos');
    ctx_ddl.add_stopword('"MYINDEX_SPL"','no');
    ctx_ddl.add_stopword('"MYINDEX_SPL"','nos');
    ctx_ddl.add_stopword('"MYINDEX_SPL"','nosotras');
    ctx_ddl.add_stopword('"MYINDEX_SPL"','nosotros');
    ctx_ddl.add_stopword('"MYINDEX_SPL"','nuestra');
    ctx_ddl.add_stopword('"MYINDEX_SPL"','nuestras');
    ctx_ddl.add_stopword('"MYINDEX_SPL"','nuestro');
    ctx_ddl.add_stopword('"MYINDEX_SPL"','nuestros');
    ctx_ddl.add_stopword('"MYINDEX_SPL"','nunca');
    ctx_ddl.add_stopword('"MYINDEX_SPL"','os');
    ctx_ddl.add_stopword('"MYINDEX_SPL"','otra');
    ctx_ddl.add_stopword('"MYINDEX_SPL"','otras');
    ctx_ddl.add_stopword('"MYINDEX_SPL"','otro');
    ctx_ddl.add_stopword('"MYINDEX_SPL"','otros');
    ctx_ddl.add_stopword('"MYINDEX_SPL"','para');
    ctx_ddl.add_stopword('"MYINDEX_SPL"','parecer');
    ctx_ddl.add_stopword('"MYINDEX_SPL"','poca');
    ctx_ddl.add_stopword('"MYINDEX_SPL"','pocas');
    ctx_ddl.add_stopword('"MYINDEX_SPL"','poco');
    ctx_ddl.add_stopword('"MYINDEX_SPL"','pocos');
    ctx_ddl.add_stopword('"MYINDEX_SPL"','por');
    ctx_ddl.add_stopword('"MYINDEX_SPL"','porque');
    ctx_ddl.add_stopword('"MYINDEX_SPL"','que');
    ctx_ddl.add_stopword('"MYINDEX_SPL"','querer');
    ctx_ddl.add_stopword('"MYINDEX_SPL"','quien');
    ctx_ddl.add_stopword('"MYINDEX_SPL"','quienes');
    ctx_ddl.add_stopword('"MYINDEX_SPL"','quienesquiera');
    ctx_ddl.add_stopword('"MYINDEX_SPL"','quienquiera');
    ctx_ddl.add_stopword('"MYINDEX_SPL"','quién');
    ctx_ddl.add_stopword('"MYINDEX_SPL"','qué');
    ctx_ddl.add_stopword('"MYINDEX_SPL"','ser');
    ctx_ddl.add_stopword('"MYINDEX_SPL"','si');
    ctx_ddl.add_stopword('"MYINDEX_SPL"','siempre');
    ctx_ddl.add_stopword('"MYINDEX_SPL"','suya');
    ctx_ddl.add_stopword('"MYINDEX_SPL"','suyas');
    ctx_ddl.add_stopword('"MYINDEX_SPL"','suyo');
    ctx_ddl.add_stopword('"MYINDEX_SPL"','suyos');
    ctx_ddl.add_stopword('"MYINDEX_SPL"','sí');
    ctx_ddl.add_stopword('"MYINDEX_SPL"','sín');
    ctx_ddl.add_stopword('"MYINDEX_SPL"','tal');
    ctx_ddl.add_stopword('"MYINDEX_SPL"','tales');
    ctx_ddl.add_stopword('"MYINDEX_SPL"','tan');
    ctx_ddl.add_stopword('"MYINDEX_SPL"','tanta');
    ctx_ddl.add_stopword('"MYINDEX_SPL"','tantas');
    ctx_ddl.add_stopword('"MYINDEX_SPL"','tanto');
    ctx_ddl.add_stopword('"MYINDEX_SPL"','tantos');
    ctx_ddl.add_stopword('"MYINDEX_SPL"','te');
    ctx_ddl.add_stopword('"MYINDEX_SPL"','tener');
    ctx_ddl.add_stopword('"MYINDEX_SPL"','ti');
    ctx_ddl.add_stopword('"MYINDEX_SPL"','toda');
    ctx_ddl.add_stopword('"MYINDEX_SPL"','todas');
    ctx_ddl.add_stopword('"MYINDEX_SPL"','todo');
    ctx_ddl.add_stopword('"MYINDEX_SPL"','todos');
    ctx_ddl.add_stopword('"MYINDEX_SPL"','tomar');
    ctx_ddl.add_stopword('"MYINDEX_SPL"','tuya');
    ctx_ddl.add_stopword('"MYINDEX_SPL"','tuyo');
    ctx_ddl.add_stopword('"MYINDEX_SPL"','tú');
    ctx_ddl.add_stopword('"MYINDEX_SPL"','un');
    ctx_ddl.add_stopword('"MYINDEX_SPL"','una');
    ctx_ddl.add_stopword('"MYINDEX_SPL"','unas');
    ctx_ddl.add_stopword('"MYINDEX_SPL"','unos');
    ctx_ddl.add_stopword('"MYINDEX_SPL"','usted');
    ctx_ddl.add_stopword('"MYINDEX_SPL"','ustedes');
    ctx_ddl.add_stopword('"MYINDEX_SPL"','varias');
    ctx_ddl.add_stopword('"MYINDEX_SPL"','varios');
    ctx_ddl.add_stopword('"MYINDEX_SPL"','vosotras');
    ctx_ddl.add_stopword('"MYINDEX_SPL"','vosotros');
    ctx_ddl.add_stopword('"MYINDEX_SPL"','vuestra');
    ctx_ddl.add_stopword('"MYINDEX_SPL"','vuestras');
    ctx_ddl.add_stopword('"MYINDEX_SPL"','vuestro');
    ctx_ddl.add_stopword('"MYINDEX_SPL"','vuestros');
    ctx_ddl.add_stopword('"MYINDEX_SPL"','y');
    ctx_ddl.add_stopword('"MYINDEX_SPL"','yo');
    ctx_ddl.add_stopword('"MYINDEX_SPL"','él');
    end;
    begin
    ctx_ddl.create_preference('"MYINDEX_STO"','BASIC_STORAGE');
    ctx_ddl.set_attribute('"MYINDEX_STO"','R_TABLE_CLAUSE','lob (data) store as (cache)');
    ctx_ddl.set_attribute('"MYINDEX_STO"','I_INDEX_CLAUSE','compress 2');
    end;
    begin
    ctx_output.start_log('MYINDEX_LOG');
    end;
    create index "BDZW"."MYINDEX"
    on "BDZW"."MYTABLE"
    ("TXT")
    indextype is ctxsys.context
    parameters('
    datastore "MYINDEX_DST"
    filter "MYINDEX_FIL"
    section group "MYINDEX_SGP"
    lexer "MYINDEX_LEX"
    wordlist "MYINDEX_WDL"
    stoplist "MYINDEX_SPL"
    storage "MYINDEX_STO"
    begin
    ctx_output.end_log;
    end;
    /

  • How to search for a set of string in a column

    Dear all,
    From a client application I have a Text field where the user can enter a text or a sentence for instance like :
    "Home for rent"
    How to make an efficient search in my table for records containing the search patter ?
    Knowing that it could be a set of words like "HOME RENT POOL"
    Idea is to make a kind of semantic search based on the words and return records that match.
    Any advise is welcome
    regards

    You should definitely look into full-text search. The idea that Kalman floated is doable, but it require a lot more work on your part. Full-text does a lot work for you, for instance handling inflections, so that a search on "goose" will get a
    hit on "geese".
    If you have never worked with full-text search before, I recommend to get your hands on this book:
    http://www.sqlservermvpdeepdives.com/
    http://www.amazon.com/SQL-Server-MVP-Deep-Dives/dp/1935182048/ref=sr_1_1?ie=UTF8&qid=1400851023&sr=8-1&keywords=sql+server+mvp+deep+dives
    This book is a collection of chapters written by a number of SQL Server MVPs, and all our royalties goes to War Child International, so you are supporting a good aim if you buy this book.
    Chapter 13 by Robert Cain is an excellent introduction to full-text search, although it does not handle Semantic Search added in SQL 2012.
    As it happens, my chapter, describes a solution of what Kalman had in mind, although it aimed for the case where you want to permit users to search arbitrary character sequence, and that is not want you want.
    Erland Sommarskog, SQL Server MVP, [email protected]

  • Search for numberic

    Hi all,
    What would be the fastest way to get this result: -
    Given an alphanumeric ABC123, and expected result is 123.
    This alphanumeric would be dynamically changed, but the alpha is constantly comes first then numeric. It could be DDD123 or AAAAB123, and the expected result is 123.
    Please share with me your ideas.
    Thanks in advance.

    Hi,
    Data : string1(10)  type c.
    Data : string2(10)  type c.
    Data : string3(10)  type c.
    Data : l1(2) type i.
    Data : l2(2) type i.
    string1 = 'ABC123'.
      l1 = strlen( string1 ).
    Do l1 times.
    l2 = ( l1-1 )
    if  string1+l2(1)  CA SY-ABCDE.
        continue.
    else.
    cnt = 1.
    if cnt1 = 1.
    move string1+l2(1) to string2.
    move string2 into string3.
    clear string2
    else.
    move string1+l2(1) to string2.
    concatenate string3 string2  into string3 .
    clear string2.
    endif.
    cnt1 = cnt1 + 1.
    endif.
    enddo.
    Rgds
    Siva.

  • How to search all files in folders/subfolders for one or more strings?

    I have a list of files (full path and file name) in Column D of my worksheet.  I'm trying to figure out how to run some code to open each file in this array (starting on D14 and going down), search for one or more strings, and then put an "X"
    in Column I, in the same row as the file name.
    How can I do that?
    I experimented with a few samples of code.  It seems pretty easy to do it in one folder, but not all sub folders.  The folder/subfolder is setup a specific way for a specific purpose.
    Knowledge is the only thing that I can give you, and still retain, and we are both better off for it.

    Below is an example that allow you to search a directory and its subdirs txt files(you can change this), read its lines and search for specific word:
    using System;
    using System.IO;
    using System.Linq;
    class Program
    static void Main(string[] args)
    try
    var files = from file in Directory.EnumerateFiles(@"c:\", "*.txt", SearchOption.AllDirectories)
    from line in File.ReadLines(file)
    where line.Contains("Microsoft")
    select new
    File = file,
    Line = line
    foreach (var f in files)
    Console.WriteLine("{0}\t{1}", f.File, f.Line);
    Console.WriteLine("{0} files found.", files.Count().ToString());
    catch (UnauthorizedAccessException UAEx)
    Console.WriteLine(UAEx.Message);
    catch (PathTooLongException PathEx)
    Console.WriteLine(PathEx.Message);
    https://msdn.microsoft.com/en-us/library/dd997370%28v=vs.110%29.aspx?f=255&MSPPError=-2147217396
    Fouad Roumieh

  • How to search for a text string in Reports designer?

    In iDS reports (10gR2), I want to search from top down for a text string was used in one of the queries or triggers. In Forms, you can do it, in reports the related menu item is always seems to be grayed out no matter what item I pick in the Navigator. Is it doable or not? If yes, then how. I don't wanna open each program piece including the queries in the data model, report triggers or program units and look for (by visual scanning) for the text I am searching for. This is crazy. There must be a way to do it. Thanx.

    That is pretty bad for such an expensive report development program. The forms allows it, I wonder why Oracle did not include similar functionality in the reports developer. I knew the conversion to ascii, but during development it is pain in the ... just to search for a simple text string in the related program units in the report, to convert to ascii, do the search and then go back to the developer. Anyway, if that is the only way, there is nothing we can do I guess :(

  • Search for text in PDF by VBA with only Adobe Reader installed

    My problem is widely known and frequenty posted, for instance:
    "Can anyone help me to open and search for a specific text string in a PDF document, return a true or false indicator (and nothing else)?"
    The answers mostly refer to and include
      Set gApp = CreateObject("AcroExch.App")
    which, as I understand, works only with a certain level of Adobe Acrobat being installed.
    My question now:
    I want to give this type of functionality (via an MSAccess Form, i.e. populate a ComboBox with PDF filenames which answer YES to certain text occurences)  to - say 20 - users in my company who have Adobe Reader 9.1 installed and not more.
    Bying this number of Adobe Acrobat licenses for just this purpose would be a heavy overkill which I just can't afford.
    Any suggestions? many thanks in advance.

    Now we would like to search in this PDF binary for an special text or string to use them for changing filename. Is there any way to do that?
    Based on your posting it sounds a bit like you're doing ABAP processing. However, I'll ignore that for now and just say that in the Java environment I have had good experience with the Java Library [iText PDF|http://itextpdf.com/]. I'm not sure what SAP offers in that area, but they must have something, because [TREX|http://help.sap.com/saphelp_nw70/helpdata/EN/a4/929d4206b70931e10000000a1550b0/frameset.htm] "understands" PDF (though that doesn't mean that you have a nice API for parsing PDFs).
    You probably investigated this already, but I'd take a look at possibilities to hook in before (or at the time) the PDF gets generated (might be easier to craft and export a filename there). Thanks to the [enhancement framework|http://help.sap.com/saphelp_nw70ehp2/helpdata/en/94/9cdc40132a8531e10000000a1550b0/frameset.htm] you usually have quite a few ways to get things done...
    Note that even if you're able to read a PDF, it doesn't necessarily mean that you can parse it the way you want. A silly example would be scanned pages, where the page is stored as an image and at best the scanner software runs some OCR (with possibly buggy results) to provide capabilities for searching the PDF. In your case that's probably not an issue, but still the question might be if the information you're looking at is structured enough to get it back...
    Cheers, harald

  • Searching for * _ and %

    Hi,
    I have a column that contains a long string, e.g.
    0^1^2^5^41^1651+8326+7.0^2^0^0^1^0^-1^16^-1^1^UU^0^-1^1^0^0^0~83367^103591331~105703742~105980488^^0^14^0^^
    I want to run a search to get the count of records that have * , _, or % in the string. Of course, those a the special chars that are used in LIKE statement and I would be able to find what am looking for if the value was a single character.
    So it looks like am out of luck. Just wanted to confirm that there's no other way to search for those in the string?
    Thanks,

    Actually, there's more than one way to do it.
    If you have 10g you can try these methods.
    create table a( val varchar2(10) );
    insert into a values ( 'aaa' );
    insert into a values ( 'a%a' );
    insert into a values ( 'a_a' );
    insert into a values ( 'a*a' );
    insert into a values ( null );
    commit;
    select *
    from   a
    where  regexp_like( val, '%|_|\*' ) ;
    VAL
    a%a
    a_a
    a*a
    select *
    from   a
    where  regexp_like( val, '[%_*]' ) ;
    VAL
    a%a
    a_a
    a*aSee SQL Snippets: SQL Features Tutorials - Regular Expressions for more on Regular Expressions, especially this page, Specifying WHAT to Match - Part 1.
    For versions earlier than 10g you can do it this way.
    select *
    from   a
    where  val like '%\%%' escape '\'
    or     val like '%\_%' escape '\'
    or     val like '%*%' ;
    VAL
    a%a
    a_a
    a*a--
    Joe Fuda
    SQL Snippets
    Message was edited by: SnippetyJoe
    - added regexp character list solution

  • How to search for particular string in array?

    I am struggling to figure out how to search array contents for a string and then delete the entry from the array if it is found.
    The code for a program that allows the user to enter up to 20 inventory items (tools) is posted below; I apologize in advance for it as I am also not having much success grasping the concept of OOP and I am certain it is does not conform although it all compiles.
    Anyway, if you can provide some assistance as to how to go about searching the array I would be most grateful. Many thanks in advance..
    // ==========================================================
    // Tool class
    // Reads user input from keyboard and writes to text file a list of entered
    // inventory items (tools)
    // ==========================================================
    import java.io.*;
    import java.text.DecimalFormat;
    public class Tool
    private String name;
    private double totalCost;
    int units;
      // int record;
       double price;
    // Constructor for Tool
    public Tool(String toolName, int unitQty, double costPrice)
          name  = toolName;
          units = unitQty;
          price = costPrice;
       public static void main( String args[] ) throws Exception
          String file = "test.txt";
          String input;
          String item;
          String addItem;
          int choice = 0;
          int recordNum = 1;
          int qty;
          double price;
          boolean valid;
          String toolName = "";
          String itemQty = "";
          String itemCost = "";
          DecimalFormat fmt = new DecimalFormat("##0.00");
          // Display menu options
          System.out.println();
          System.out.println(" 1. ENTER item(s) into inventory");
          System.out.println(" 2. DELETE item(s) from inventory");
          System.out.println(" 3. DISPLAY item(s) in inventory");
          System.out.println();
          System.out.println(" 9. QUIT program");
          System.out.println();
          System.out.println("==================================================");
          System.out.println();
          // Declare and initialize keyboard input stream
          BufferedReader stdin = new BufferedReader(new InputStreamReader(System.in));
          do
             valid = false;
             try
                System.out.print(" Enter an option > ");
                input = stdin.readLine();
                choice = Integer.parseInt(input);
                System.out.println();
                valid = true;
             catch(NumberFormatException exception)
                System.out.println();
                System.out.println(" Only numbers accepted. Try again.");
          while (!valid);
          while (choice != 1 && choice != 2 && choice != 9)
                System.out.println(" Not a valid option. Try again.");
                System.out.print(" Enter an option > ");
                input = stdin.readLine();
                choice = Integer.parseInt(input);
                System.out.println();
          if (choice == 1)
             // Declare and initialize input file
             FileWriter fileName = new FileWriter(file);
             BufferedWriter bufferedWriter = new BufferedWriter(fileName);
             PrintWriter dataFile = new PrintWriter(bufferedWriter);
             do
                addItem="Y";
                   System.out.print(" Enter item #" + recordNum + " name > ");
                   toolName = stdin.readLine();
                   if (toolName.length() > 15)
                      toolName = toolName.substring(0,15); // Convert to uppercase
                   toolName = toolName.toUpperCase();
                   dataFile.print (toolName + "\t");
                   do
                      valid = false;
                      try
                         // Prompt for item quantity
                         System.out.print(" Enter item #" + recordNum + " quantity > ");
                         itemQty = stdin.readLine();
                         // Parse integer as string
                         qty = Integer.parseInt (itemQty);
                         // Write item quantity to data file
                         dataFile.print(itemQty + "\t");
                         valid=true;
                      catch(NumberFormatException exception)
                         // Throw error for all non-integer input
                         System.out.println();
                         System.out.println(" Only whole numbers please. Try again.");
                   while (!valid);
                   do
                      valid = false;
                      try
                         // Prompt for item cost
                         System.out.print(" Enter item #" + recordNum + " cost (A$) > ");
                         itemCost = stdin.readLine();
                         // Parse float as string
                         price = Double.parseDouble(itemCost);
                         // Write item cost to data file
                         dataFile.println(fmt.format(price));
                         valid = true;
                      catch(NumberFormatException exception)
                         // Throw error for all non-number input (integers
                      // allowed)
                         System.out.println();
                         System.out.println(" Only numbers please. Try again.");
                   while (!valid);
                   // Prompt to add another item
                   System.out.println();
                   System.out.print(" Add another item? Y/N > ");
                   addItem = stdin.readLine();
                   while ((!addItem.equalsIgnoreCase("Y")) && (!addItem.equalsIgnoreCase("N")))
                      // Prompt for valid input if not Y or N
                      System.out.println();
                      System.out.println(" Not a valid option. Try again.");
                      System.out.print(" Add another item? Y/N > ");
                      addItem = stdin.readLine();
                      System.out.println();
                   // Increment record number by 1
                   recordNum++;
                   if (addItem.equalsIgnoreCase("N"))
                      System.out.println();
                      System.out.println(" The output file \"" + file + "\" has been saved.");
                      System.out.println();
                      System.out.println(" Quitting program.");
            while (addItem.equalsIgnoreCase("Y"));
    // Close input file
    dataFile.close();
       if (choice == 2)
       try {
          Read user input (array search string)
          Search array
          If match found, remove entry from array
          Confirm "deletion" and display new array contents
       catch block {
    } // class
    // ==========================================================
    // ListToolDetails class
    // Reads a text file into an array and displays contents as an inventory list
    // ==========================================================
    import java.io.*;
    import java.util.StringTokenizer;
    import java.text.DecimalFormat;
    public class ListToolDetails {
       // Declare variable
       private Tool[] toolArray; // Reference to an array of objects of type Tool
       private int toolCount;
       public static void main(String args[]) throws Exception {
          String line, name, file = "test.txt";
          int units, count = 0, record = 1;
          double price, total = 0;
          DecimalFormat fmt = new DecimalFormat("##0.00");
          final int MAX = 20;
          Tool[] items = new Tool[MAX];
          System.out.println("Inventory List");
          System.out.println();
          System.out.println("REC.#" + "\t" + "ITEM" + "\t" + "QTY" + "\t"
                + "PRICE" + "\t" + "TOTAL");
          System.out.println("\t" + "\t" + "\t" + "\t" + "PRICE");
          System.out.println();
          try {
             // Read a tab-delimited text file of inventory items
             FileReader fr = new FileReader(file);
             BufferedReader inFile = new BufferedReader(fr);
             StringTokenizer tokenizer;
             while ((line = inFile.readLine()) != null) {
                tokenizer = new StringTokenizer(line, "\t");
                name = tokenizer.nextToken();
                try {
                   units = Integer.parseInt(tokenizer.nextToken());
                   price = Double.parseDouble(tokenizer.nextToken());
                   items[count++] = new Tool(name, units, price);
                   total = units * price;
                } catch (NumberFormatException exception) {
                   System.out.println("Error in input. Line ignored:");
                   System.out.println(line);
                System.out.print(" " + count + "\t");
                System.out.print(line + "\t");
                System.out.print(fmt.format(total));
                System.out.println();
             inFile.close();
          } catch (FileNotFoundException exception) {
             System.out.println("The file " + file + " was not found.");
          } catch (IOException exception) {
             System.out.println(exception);
          System.out.println();
       //  Unfinished functionality for displaying "error" message if user tries to
       //  add more than 20 tools to inventory
       public void addTool(Tool maxtools) {
          if (toolCount < toolArray.length) {
             toolArray[toolCount] = maxtools;
             toolCount += 1;
          } else {
             System.out.print("Inventory is full. Cannot add new tools.");
       // This should search inventory by string and remove/overwrite matching
       // entry with null
       public Tool getTool(int index) {
          if (index < toolCount) {
             return toolArray[index];
          } else {
             System.out
                   .println("That tool does not exist at this index location.");
             return null;
    }  // classData file contents:
    TOOL 1     1     1.21
    TOOL 2     8     3.85
    TOOL 3     35     6.92

    Ok, so you have an array of Strings. And if the string you are searching for is in the array, you need to remove it from the array.
    Is that right?
    Can you use an ArrayList<String> instead of a String[ ]?
    To find it, you would just do:
    for (String item : myArray){
       if (item.equals(searchString){
          // remove the element. Not trivial for arrays, very easy for ArrayList
    }Heck, with an arraylist you might be able to do the following:
    arrayList.remove(arrayList.indexOf(searchString));[edit]
    the above assumes you are using 1.5
    uses generics and for each loop
    [edit2]
    and kinda won't work it you have to use an array since you will need the array index to be able to remove it. See the previous post for that, then set the value in that array index to null.
    Message was edited by:
    BaltimoreJohn

Maybe you are looking for

  • ReG: Open Item Clearing Value is showing is difference

    Hi All, Acutal invoice value is 3,289.90 . but it f-44  clearing value is shwoing 3,176.35. how can solve this problmem. plz help gurs. with regards JK Rao

  • Cisco Wireless AP 2602 - Web Authentication/Pass NOT working?

    Product/Model                                       Number: AIR-CAP2602E-A-K9 Top                                       Assembly Serial Number: System                                       Software Filename: ap3g2-k9w7-xx.152-4.JB3a System           

  • Client proxy data not reaching XI ?

    Hi Guys, I have a scenario proxy-soap asynchronus. when i execute the report on the R/3 side the report executes successfully and in the sxmb_moni receiver which is IE of xi is not identified and the data is not reaching XI. But when i execute the re

  • Security Violation

    I use JDBC for connect to Database ( 7.3.4) and put my applet on OAS 3.0, and when i request this applet from browser i got the message "Applet lines secuiry Violation. security couldn't connect to <Hostname> with origin from <OAS Name> thx null

  • HT201210 Why can I not restore my iPad form recovery mode

    Why I am I not able to reach the servers to restore my iPad from recovery mode.