Replacing character and number e.g #1154;#" with a comma using powershell

Hi there,
       How can i replace
I have a string like below  and would like to replace ";#1154;#" with a comma.
tried using (;#)\d{4}(;#)" but it doesnt work
Amber Wood;#1154;#John Roberts;#1121;#Peter Ma;#1597;#
Thanks in Advance
Output should be : 
Amber Wood,John Roberts,Peter Ma

The regex is almost right, but you don't need the normal brackets. If you remove them as per :
$a = "Amber Wood;#1154;#John Roberts;#1121;#Peter Ma;#1597;#"
$b = $a -replace ";#\d{4};#",","
$b
you'll see that works.

Similar Messages

  • How can if find the most repeated character and number ???

    Hi,
    I have a question. For instance, if we have a text file which contains:
    aaabbbhhhhhhtttttsjs12366
    How can i find the most repeated character and number. I have to add this code to the following program:
    I will aprreciate if you can help.
    Regards,
    Serkan
    import java.io.*;
    public class LineLen {
         public static void main(String args[]) throws Throwable {
              final String filename = "deneme1.txt";
              BufferedReader infile = new BufferedReader(new InputStreamReader(new FileInputStream(filename)));
              String line = infile.readLine();
              int linenum = 0;
              while (line != null) {
                   int len = line.length();
                   linenum++;
                   System.out.print(linenum + "\t");
                   for (int i = 0; i<len; i++)
                   System.out.print("*");
                   System.out.println("");
                   line = infile.readLine();
    }

    For a small alphabet like English, array migt be used:
    //in a for loop
    ++array[s.charAt(i)];For a big alphabet like chinese, HashMap might be barely used:
    map.put(s.charAt(i), increment(map.get(s.charAt(i))));
    // increment is a user defined method, possibly for an Integer object,
    // that returns a new Integer object

  • Separating character and number within the string

    I want to separate the character and the number within one string.
    For example,
    12345ABCD (the numbers and character may differ in lengths)
    I want to separate into two different string of 12435 and ABCD.
    Your help would be greatly appreciated.
    Thanks!

    here is an example:
    sample_separator.sql
    declare
      i        number := 0;
      j        number := 0;
      x        number := 0;
      vBasis   Varchar2(40) := '12345ABCD';
      vString1 Varchar2(40);
      vString2 Varchar2(40);
    begin
      for x in 1 .. length(vBasis) loop
        for i in 0 .. 9 loop
          if substr(vBasis,x,1) = to_char(i) then     
            vString1 := vString1 || substr(vBasis,x,1);
          end if;
        end loop;
        for j in 65 .. 90 loop
          if substr(vBasis,x,1) = chr(j) then
            vString2 := vString2 || substr(vBasis,x,1);
          end if;
        end loop;   
      end loop;
      dbms_output.put_line('vString1: '||vString1);
      dbms_output.put_line('vString2: '||vString2);
    end;
    /when run:
    SQL> @r:\sample_separator.sql;
    vString1: 12345
    vString2: ABCD
    PL/SQL procedure successfully completed.
    SQL> hope this helps.

  • How to Compare 2 CSV file and store the result to 3rd csv file using PowerShell script?

    I want to do the below task using powershell script only.
    I have 2 csv files and I want to compare those two files and I want to store the comparision result to 3rd csv file. Please look at the follwingsnap:
    This image is csv file only. 
    Could you please any one help me.
    Thanks in advance.
    By
    A Path finder 
    JoSwa
    If a post answers your question, please click &quot;Mark As Answer&quot; on that post and &quot;Mark as Helpful&quot;
    Best Online Journal

    Not certain this is what you're after, but this :
    #import the contents of both csv files
    $dbexcel=import-csv c:\dbexcel.csv
    $liveexcel=import-csv C:\liveexcel.csv
    #prepare the output csv and create the headers
    $outputexcel="c:\outputexcel.csv"
    $outputline="Name,Connection Status,Version,DbExcel,LiveExcel"
    $outputline | out-file $outputexcel
    #Loop through each record based on the number of records (assuming equal number in both files)
    for ($i=0; $i -le $dbexcel.Length-1;$i++)
    # Assign the yes / null values to equal the word equivalent
    if ($dbexcel.isavail[$i] -eq "yes") {$dbavail="Available"} else {$dbavail="Unavailable"}
    if ($liveexcel.isavail[$i] -eq "yes") {$liveavail="Available"} else {$liveavail="Unavailable"}
    #create the live of csv content from the two input csv files
    $outputline=$dbexcel.name[$i] + "," + $liveexcel.'connection status'[$i] + "," + $dbexcel.version[$i] + "," + $dbavail + "," + $liveavail
    #output that line to the csv file
    $outputline | out-file $outputexcel -Append
    should do what you're looking for, or give you enough to edit it to your exact need.
    I've assumed that the dbexcel.csv and liveexcel.csv files live in the root of c:\ for this, that they include the header information, and that the outputexcel.csv file will be saved to the same place (including headers).

  • How do I hide the microsoft agent character and have only the balloon with audio show up

    I would like my LabVIEW program to show only the Microsfot agent balloon with audio but hide the character. Is that possible?

    I played with the Agent a while ago and it seems there was a couple characters that were audio only. Of course you could display the balloon text also. But I dn't seem to have them any more.
    You might try posting to the Agent news group at microsoft.public.msagent Somebody there is sure to know.
    Ed
    Ed Dickens - Certified LabVIEW Architect - DISTek Integration, Inc. - NI Certified Alliance Partner
    Using the Abort button to stop your VI is like using a tree to stop your car. It works, but there may be consequences.

  • I have recently swapped my iPhone for a new Samsung S4 contract with new sim and number, but when people with iPhones message me they are sending as iMessage.

    I have taken out a new contract with a Samsung S4 as the mobile device. It has a new sim card I got with the contract and new number. However, when friends with iPhones message me it is sending from their phone as iMessage meaning I am not receiving texts from them. Is this a fault on their side or mine? How do I fix the problem so I am receiving messages from them instead of it sending as iMessage and not received on my phone. Please help

    Read here regarding what you should have done & how to fix:
    http://support.apple.com/kb/HT5661

  • Sql query to seperate character and number data in a column

    Hi,
    We have a test table on 10.2.0.4 db as below;
    10:44:34 TEST:WAULT > desc t;
    Name Null? Type
    EMP VARCHAR2(10)
    10:43:18 TEST:WAULT > select * from t;
    EMP
    JOHN
    7281
    TOM
    7852145
    BNPPARIBAS
    9862354
    Mindcraft
    875
    INFINITY
    78998775
    01234
    EMP
    0
    -123
    -856359
    SCOTT
    -657
    16 rows selected.
    The question is; we need to segregate the character data and numerical data in the EMP field, using sql query.
    Plz suggest as to how we can achieve this.
    Also, plz suggest how the use of reqexp can be made in this to achieve the same.
    Thanks,
    Rahul

    >
    Hi,
    EMP
    JOHN
    7281
    TOM
    7852145
    The question is; we need to segregate the character data and numerical data in the EMP field, using sql query.
    Plz suggest as to how we can achieve this.Check out the CAST function
    http://download.oracle.com/docs/cd/B12037_01/server.101/b10759/functions015.htm
    However, I would have to ask why on earth you're doing this - it would, IMHO, be
    much better to redesign your app. It looks like you have an EAV problem
    (AKA MUCK or OTLT) Google Joe Celko and these terms.
    Paul...
    Rahul

  • Using iChat AV and trying to video conference with a PC using AIM

    I am trying to create an AV session from my mac to a PC. I am using iChat with an AIM username and the PC is using AIM. Everytime i try to establish a video connection it says that I did not respond. What can I do to fix this?

    HI Helen,
    Just to check.
    He is on XP ?
    He is using AIM 5.9 ?
    He has Tuned the camera and Mic to the App ?
    If he is at Service Pack 2 he has enabled the app through the XP firewall ?
    You have the MAc firewall Off.
    The ports are enabled in your modem.
    Either using UPnP or these actual ports
    5060, 5190, 5678, 16384-16403 for just the AIM stuff.
    Have you changed the Quicktime setting to match your download speed ?
    Can you and he get any of the people or test accounts o this page ?
    http://www.ralphjohnsuk.dsl.pipex.com/ContactTesters.html
    2:34 PM Saturday; April 8, 2006

  • Sandpit and Dev give Address search with different results using Web UI

    Using the Sandpit system I can perform a BP search on Street and enter the post code, but it still finds the right address. However, in our development sytsem it does not. The FM which performs the search is identical so I assume this would be down to some kind of address related config?. Can anyone enlighten me further as what could possible cause this?.
    Jason
    [RESOLVED]
    Edited by: Jason Stratham on Sep 8, 2009 11:35 AM

    Okay. So, I asked the admin to create a scope for the list, which they did following the steps outlined in Ben Tedders article, and then I followed the steps in the rest of the article setting up the web parts. When I ran a search, it returned the no results
    page. Not sure why, but I removed the scope from the Search Core Results web part, and the search returned usable data from the list.
    Here's my part ii question - - how do I customize the Search Core Results web part to display the data from the search in manner that makes more sense than from a list of nondescript layout of,
    Search Result
         Search Term ... dataField01 ... dataField02 ... dataField03 ... dataField04 ...
         author info
    url info
    to something a tad more informative, such as,
    You search for Search Term, with the following results:
         Search Result
              dataField01 label ... dataField01
              dataField02 label ... dataField02
              dataField03 label ... dataField03
              dataField04 label ... dataField04
    because nobody's really going to care who uploaded the list or want to link to the data pulled from the list in one of those columnar results tables.

  • List items archival with version history using powershell

    HI
    Is there any way to work with site and content structure in SharePoint 2010 with power-shell.
    I want to run a automated task(power shell script) to move list items from source to destination in the same site with version history.
    I know i can do it from site and content organizer but i have to do manually and SharePoint designer workflows doesn't retain the version history.
    Please give me  your valuable tips.

    Hi Manikanta,
    Archive ListItem with Version History in SharePoint, I suggesting you the best links for your solution here
    http://techno-sharepoint.blogspot.sg/2012/10/moving-sharepoint-list-items-to-archive.html
    http://get-spscripts.com/2011/10/copy-sharepoint-lists-and-document.html
    For more details, reach us at
    <a href="http://staygreenacademy.com/sharepoint-2013-training/">SharePoint 2013 Online Training</a>

  • How to get the user created at and modified at properties for a site collection using powershell

    Hi guys, I Know how to get the list of users of a site collection by Get-SPUser cmdlet but hte problem is that this cmdlet doesnt give me the user Created at and modifed at properties 
    can any one tell me how to get these values via powershell???? 
    ps: ignore the 2013 screenshot.. i just want a way to get those values .. if you provide me solution in either 2010 or 2013 , i will crack the other..
    plz guys help me ...

    Get the User Information list and then get the user from that list
    $web = Get-SPWeb "siteUrl"
    $userInfoList = $web.SiteUserInfoList
    $userItem = $userInfoList.Items[0]; #0 here is just for demonstration. You take the user you want here or loop through all users.
    $created = $userItem["Created"]
    $modified = $userItem["Modified"]

  • Create Device Collection WITH Refresh Schedule using Powershel CMDLets

    Hello everyone
    I'm attempting to create a PowerShell script to create a device collection and I'm running into a very frustrating issue.  I want to be able to set the collections refresh time but can't seem to get it to work.  This code here works to create the
    collection and tell it to do incremental updates but I cannot figure out how to set refresh time.  Everything I've attempted has failed and google seems to be no help right now.
    $CollectionName = "Test"
    $CollectionQueryValue = 'select * from SMS_R_System inner join SMS_G_System_SYSTEM on SMS_G_System_SYSTEM.ResourceId = SMS_R_System.ResourceId where SMS_G_System_SYSTEM.NetBIOSName in ("Hostname")' $CollectionQueryName = "Direct by Hostname"
    New-CMDeviceCollection -Name $CollectionName -LimitingCollectionName "All Systems" -RefreshType ConstantUpdate
    Thanks for your help!

    I haven't tried it, but the following should work:
    $Sched = New-CMSchedule -Start "01/02/2014 1:00 AM"
    -DayOfWeek Sunday -RecurCount 1
    New-CMDeviceCollection -Name "C1"
    -LimitingCollectionName "All Systems" -RefreshSchedule $Sched -RefreshType Both
    Torsten Meringer | http://www.mssccmfaq.de

  • Replace document properties using powershell

    Hello ,
    I have document library. It has one column of categories. There are multiple categories tagged for many document .I want to replace some old categories with new one using powershell.
    In other words, first i need to check if that item column has that property if yes replace it with new property. 
    I dont want to change properties manually as this need checking out document. 
    Please guide. powershell script will be helpful for me.

    http://blogs.msdn.com/b/paulking/archive/2011/10/04/using-powershell-scripts-to-modify-document-properties-in-sharepoint-2010.aspx
    # Load SharePoint library
    [system.reflection.assembly]::LoadWithPartialName("Microsoft.Sharepoint")
    # Connect to the site collection http://SP2010 and store the object in the $site variable
    $site = New-Object Microsoft.SharePoint.SPSite("http://SP2010")
    # Connect to the root site in the site collection and store the object in $root
    $root = $site.rootweb
    # Store the Shared Documents document library in a variable $Docs
    $docs = $root.lists["Shared Documents"]
    # Display all the documents, their titles, names and IDs
    $docs.items | format-table -property title,name,id
    # Updates the title for each item in the list with Name
    $docs.items | ForEach { $_["Title"] = $_["Name"]; $_.Update() }
    # Display all the documents, their titles, names and IDs
    $docs.items | format-table -property title,name,idOr try http://sharepoint.stackexchange.com/questions/78084/how-to-update-document-meta-data-using-powershell$listItem = $web.GetListItem($file.ServerRelativeUrl);
    $listItem.File.Checkout();
    $listItem.Properties['My Cust Prop 1'] = 30
    $listItem.Properties['My Cust Prop 2'] = '2012-10-25T00:00:00Z'
    $listItem.Update();
    $listItem.File.Checkin('Updated')http://sharepoint.stackexchange.com/questions/61159/get-document-properties-keys-valuehttp://social.technet.microsoft.com/Forums/ro-RO/db9191e4-c1b6-4d4b-aa58-a352da1839fc/powershell-script-to-create-document-libraries-with-specific-properties?forum=sharepointadminprevious
    If this helped you resolve your issue, please mark it Answered

  • How do I bulk upload documents using PowerShell and extract metadata from file name?

    I have a requirement to upload a bunch of documents into a document library. Based on the content type, the rules of updating the metadata is different...the one giving me trouble is to extract the metadata from the file name. If I have a file name like
    "part1_part2_part3.pdf" how do I extract part1, part2, part3 and tag each document being uploaded into SharePoint, using PowerShell? I have searched and have not been able to find anything to get me started.
    Has anyone done this before? Or is there a blog I can take a look at? Thanks
     

    You will have to write a PS script encompassing this logic.
    Read files from the folder using
    Get-Item cmdlet
    Determine the content type based on the path or filename.
    Split the file name to extract the tag names.
    If the metadata fields in the content type is a managed metadata field, check whether the term exists and set it.
    Updating SharePoint Managed Metadata Columns
    with PowerShell
    This post is my own opinion and does not necessarily reflect the opinion or view of Slalom.

  • Search and replace, with pattern matching using a table

    I need to inspect a data stream and standardise a set of codes. I need to
    1. Match any patterns with a dash character and remove the dash and any following characters, eg BN-S -> BN, BN-SH -> BN, ARG-22 -> ARG, etc.
    2. Make a few specific word for word replacements, eg, PAEDSH -> PAED
    This is easy to hard code but can it be done using a table of regex substitutions? Can anyone give a pointer or link to some example code? The couple of regex replacement examples I've found use regex to locate but hard code substitutions.
    Thanks

    You could store all your patterns in a Map. Then iterate over the map inserting the patterns into a regex.

Maybe you are looking for

  • RAM issues with 10.4.8?!?!?

    Upgrading from 10.4.7 have fixed many of my problems. Certain apps take up more cpu power and ram i assume. It will freeze almost within 10 minutes of use. If i dont manually restart by holding the power button down. Within 2-5 minutes the black scre

  • Importing Item Intrastat Data using DTW

    Hi,  Is there any documentation on importing the SBO item Intrastat data?   V8.81 PL04. Thanks Simon

  • Should I upgrade to v 2.21.

    I've just discovered that 2.2.02 now has the 4hr standby fix from version ..0. I didn't install the v2 firmware before mainly because of this issue. Now that it's fixed, is there anything else to stop me from upgrading from ..0? It should hopefully h

  • Configure return type: There was an error while invoking the operation

    This error only occurs when I pass parameters to Configure return type dialog As a follow on from http://forums.adobe.com/message/2663481 I am getting this in the log. !ENTRY com.adobe.flexbuilder.DCDService 4 1 2010-06-15 11:45:29.323 !MESSAGE Pleas

  • Hanging and Very slow loading

    Hello People, Thank you in advance for your help. Im having a problem with my Mac, i have a top of the range 27" desktop mac and its approx 18 months old. Recently i have a huge issue with webpages hanging on safari, Chrome and firefox. The pages wil