logo
down
shadow

How to search for a whole word with special char using oracle contains?


How to search for a whole word with special char using oracle contains?

Content Index :

How to search for a whole word with special char using oracle contains?
Tag : sql , By : John
Date : November 24 2020, 05:44 AM


Comments
No Comments Right Now !

Boards Message :
You Must Login Or Sign Up to Add Your Comments .

Share : facebook icon twitter icon

Get only word before special char


Tag : chash , By : Marc Dong
Date : March 29 2020, 07:55 AM
seems to work fine I have the file with "chunked" sentences from medical sector. , This seem to work:
var patt = @"\s(\b(.+?))/";
var matches = Regex.Matches("[ADVP again/RB ] [VP seen/VBN ] [NP is/VBZ ] [NP a/DT focal/JJ asymmetry/NN ].", patt);

var matchedValues = matches
    .Cast<Match>()
    .Select(match => match.Groups[1].Value);

var output = string.Join(" ", matchedValues);

How to detect a special char in string and modify this special word?


Tag : chash , By : user135518
Date : March 29 2020, 07:55 AM
will help you I have a string, it may looks like this: , Perhaps simply:
str = string.Join(" ", str.Split()
                          .Select(w => w.StartsWith("@") ? "%" + w + "%" : w));
@abc.  --> wrong:  %@abc.% correct: %@abc%.
static readonly HashSet<char> WordSeparators = new HashSet<char> { ',', '.', '!', '?', ';', ':', ' ', '-', '/', '\\', '[', ']', '(', ')', '<', '>', '"', '\'' };

static string WrapWithIfStartsWith(string input, string startsWith, string wrap, StringComparison comparison = StringComparison.CurrentCulture)
{
    if (string.IsNullOrEmpty(input) || !input.StartsWith(startsWith, comparison))
        return input;
    else if(input.Length == 1)
        return string.Format("{1}{0}{1}", input, wrap);

    char first = input.First();
    char last = input.Last();
    bool firstIsSeparator = WordSeparators.Contains(first);
    bool lastIsSeparator = WordSeparators.Contains(last);
    if (firstIsSeparator && lastIsSeparator)
        return string.Format("{0}{1}{2}{1}{3}",
            first, wrap, input.Substring(1, input.Length - 2), last);
    else if (firstIsSeparator && !lastIsSeparator)
        return string.Format("{0}{1}{2}{1}",
             first, wrap, input.Substring(1));
    else if (!firstIsSeparator && lastIsSeparator)
        return string.Format("{0}{1}{0}{2}",
            wrap, input.Remove(input.Length - 1), last);
    else
        return string.Format("{1}{0}{1}", input, wrap);
}
string str = "blabalbal blabal @abc.";
str = string.Join(" ", str.Split().Select(w => WrapWithIfStartsWith(w,"@","%")));

Remove special char out of a word


Tag : python , By : Roel
Date : March 29 2020, 07:55 AM
To fix the issue you can do I am trying to count the word frequency in a long string. I have split the string into list of words using string.split() method and remove case sensity by applying string.lower() before splitting the long string. I want to remove some special character such as '!', ':', '.' as those character will mess up the word count. Below is the function that I wrote but it seems not to work properly , Use enumerate:
def clean_word(word):
    replace_list = [':','.',',','!','?']
    s = list(word)
    for i, x in enumerate(s):
        if x in replace_list:
            s[i] = ""     
    word = ''.join(s)
    return word

print(clean_word('Hello!'))

# Hello
word = 'Hello!'
replace_list = [':','.',',','!','?']

print(''.join([x for x in word if x not in replace_list]))
# Hello

Regex Python Adding a char before a random word and the special char :


Tag : python , By : sam
Date : January 03 2021, 08:18 AM
like below fixes the issue You can use r'\b' to search for word breaks. For your case you are looking for
substrings that match: [A-Za-z\-]+ and are surrounded by word breaks: \b[A-Za-z\-]+\b and are followed by a colon: \b[A-Za-z\-]+\b: You can capture the word using parenthesis: \b([A-Za-z\-]+)\b: and recover it in the substitution using \1
import re

s = 'cat: monkey, ab4 / 1997 / little: cat, 1954/ afgt22 /dog: monkey, 173 / pine-apple: duer, 129378s. / 12'

re.sub(r'(\b[A-Za-z\-]+\b):', r'|\1:', s)
# returns:
'|cat: monkey, ab4 / 1997 / |little: cat, 1954/ afgt22 /|dog: monkey, 173 / |pine-apple: duer, 129378s. / 12'

vim - why will search find it but search and replace not? (this escaped special char pattern)


Tag : linux , By : DonMac
Date : October 03 2020, 01:00 AM
help you fix your problem The substitution operation needs to be prefixed with %s and not the other way around as s%. So doing
%s/\/scripts\/monitor\/raid_status_mail\.log/\$LOGFILE/g
printf '%s\n' "%s/\/scripts\/monitor\/raid_status_mail\.log/\$LOGFILE/g" w q | ex -s file
Related Posts Related QUESTIONS :
  • Distribution of table in time
  • Backup SQL Schema Only?
  • SQL query for a database scheme
  • Timer-based event triggers
  • SQL query, count and group by
  • Paging SQL Server 2005 Results
  • SQL Server 2005 For XML Explicit - Need help formatting
  • How do I use T-SQL Group By
  • How do I split a string so I can access item x?
  • Date Condition with Case when Holiday exclude
  • SQL Query Select from 1 table and return data based on 2 columns
  • how to use rank/join and where together
  • How to create new column with values counting up every 9th value with SQL?
  • Most frequent combination of words/characters SQL Server
  • Why can't I access a field defined as "Select 1" from a subquery in the outer query?
  • How to solve Msg 8115, Level 16, State 2, Line 2 Arithmetic overflow error converting expression to data type int.?
  • UPDATE row inserted earlier in CTE
  • Display current month values based upon abbreviation (Oct) SQL Server
  • SQL Modify returned select value without union
  • How to put a variable in a like statement in vba?
  • More Elegant way to Batch Validate Phone Numbers
  • SQL find parent where children match over multiple rows
  • A combo box that has to be filter the same data in that field
  • Exclude updated record from trigger function
  • Insert into table from select only when select returns valid rows
  • How to fix SQLite3::SQLException: near "to": syntax error: SELECT "".* FROM "" WHERE "
  • Filter msdb.dbo.sysjobsteps.command into seperate columns
  • How to extract year or month,day from oracle function without using sub-query?
  • Reset sum when condition is met in Oracle
  • Date Between (Start & Now)
  • Reset running sum when condition is met in Oracle
  • Why is my date criteria filtering incorrectly in a MsysObjects query using DCount?
  • Stripping date/time delimiters in an SSIS csv export
  • SSIS Error on insertion - Error when new primary keys in Dimension table
  • How can I make a temp table of specific datetime data within a range?
  • AnalysisException: Syntax error in SQL After multiple join
  • SQL Query Multiple Columns Using Distinct on One Column Only and Using Order By
  • Sum inventory item groups
  • TSQL: Parsing strings with various characters
  • Using SQL Server : how to use select criteria based on sum
  • Inserting dynamic pivot Result into Temp table
  • Joining multiple fields in a dataset joined with descriptions
  • Conditional WHERE EXISTS in Oracle query
  • How to get the count of each unique value in a column between two dates?
  • SQL: Select only if multiple values are IN 1 column from CatalogTable
  • In a query (no editing of tables) how do I join data without any similarities?
  • Create nested json blobs in PostgreSQL
  • Getting extra dates while using cte
  • Way to alter one table if another was altered
  • Proper use of semicolons in functions and procedures
  • Cursor Not looping all the Records
  • Select inner join returns wrong result
  • Group By showing duplicates
  • Error in using subquery in access join query
  • How do I use a composite pk in a stored procedure?
  • Oracle Unique Indexes
  • Spooling data to CSV truncates
  • How do views reduce code duplication?
  • SQL: Gather right hand values from a join
  • SQL Agent Logon - What is going on?
  • shadow
    Privacy Policy - Terms - Contact Us © scrbit.com